public final class ResourcePersistenceData extends AbstractResourceRegistration implements MarkableRegistration, RegistrationMarker<ResourcePersistenceData>, java.io.Serializable, SerializedResourceData
Note: This implementation is truly serializable if and only if the underlying resource is serializable. Otherwise this implementation serializes resource's data necessary to obtain the resource from the core resource provider after deserialization at runtime.
Modifier and Type | Method and Description |
---|---|
ResourcePersistenceData |
applyRegisteredMark()
Applies the registered mark by registering or
unregistering the underlying registrable object.
|
static java.util.Set<ResourcePersistenceData> |
defaults() |
<A extends java.lang.annotation.Annotation> |
getAnnotation(java.lang.Class<A> type) |
java.util.List<java.lang.annotation.Annotation> |
getAnnotations() |
java.lang.Class<? extends Listener> |
getListenerType()
Returns the listener type to which
is the underlying resource registered.
|
Resource<?> |
getResource()
Returns the underlying resource.
|
java.lang.String |
getResourceName()
Returns the underlying resource name.
|
com.google.common.base.Optional<Resource<?>> |
getSerializedResource()
Gets the serialized resource if available.
|
boolean |
hasAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> type) |
boolean |
hasRegistredMark()
Returns
true if the underlying registrable
object is marked as registered, false otherwise. |
boolean |
hasSerializedResource()
Returns
true if this object holds
a serialized resource, false otherwise. |
ResourcePersistenceData |
markRegistered(boolean status)
Marks registration with the desired registration status.
|
static <L extends Listener> |
of(java.lang.Class<L> type,
Resource<? super L> resource) |
static <L extends Listener> |
of(java.lang.Class<L> type,
java.lang.String name) |
static java.util.Set<ResourcePersistenceData> |
snapshot() |
ResourcePersistenceData |
updateRegisteredMark()
Updates the registered mark according to the current
registration status of the underlying registrable object.
|
equals, hashCode, isProvided, isRegistered, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
equals, hashCode
getAnnotation, getAnnotations, hasAnnotation
isProvided, isRegistered
public static <L extends Listener> ResourcePersistenceData of(java.lang.Class<L> type, java.lang.String name)
public static <L extends Listener> ResourcePersistenceData of(java.lang.Class<L> type, Resource<? super L> resource)
public static java.util.Set<ResourcePersistenceData> defaults()
public static java.util.Set<ResourcePersistenceData> snapshot()
public ResourcePersistenceData applyRegisteredMark()
RegistrationMarker
Note: This method propagates runtime exceptions thrown by the registration mechanism of the underlying registrable object.
applyRegisteredMark
in interface RegistrationMarker<ResourcePersistenceData>
public ResourcePersistenceData updateRegisteredMark()
RegistrationMarker
updateRegisteredMark
in interface RegistrationMarker<ResourcePersistenceData>
public ResourcePersistenceData markRegistered(boolean status)
RegistrationMarker
markRegistered
in interface RegistrationMarker<ResourcePersistenceData>
status
- the desired registration statuspublic boolean hasRegistredMark()
MarkableRegistration
true
if the underlying registrable
object is marked as registered, false
otherwise.hasRegistredMark
in interface MarkableRegistration
public boolean hasSerializedResource()
SerializedResourceData
true
if this object holds
a serialized resource, false
otherwise.
More formally, this method returns true
if and
only if getSerializedResource().isPresent() == true
.
hasSerializedResource
in interface SerializedResourceData
public java.lang.Class<? extends Listener> getListenerType()
ResourceRegistration
getListenerType
in interface ResourceRegistration
public Resource<?> getResource()
ResourceRegistration
getResource
in interface ResourceRegistration
public java.lang.String getResourceName()
ResourceRegistration
getResourceName
in interface ResourceRegistration
public com.google.common.base.Optional<Resource<?>> getSerializedResource()
SerializedResourceData
getSerializedResource
in interface SerializedResourceData
public final boolean hasAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> type)
hasAnnotation
in interface Annotable
public final <A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.Class<A> type)
getAnnotation
in interface Annotable
public final java.util.List<java.lang.annotation.Annotation> getAnnotations()
getAnnotations
in interface Annotable