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, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitequals, hashCodegetAnnotation, getAnnotations, hasAnnotationisProvided, isRegisteredpublic 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()
RegistrationMarkerNote: This method propagates runtime exceptions thrown by the registration mechanism of the underlying registrable object.
applyRegisteredMark in interface RegistrationMarker<ResourcePersistenceData>public ResourcePersistenceData updateRegisteredMark()
RegistrationMarkerupdateRegisteredMark in interface RegistrationMarker<ResourcePersistenceData>public ResourcePersistenceData markRegistered(boolean status)
RegistrationMarkermarkRegistered in interface RegistrationMarker<ResourcePersistenceData>status - the desired registration statuspublic boolean hasRegistredMark()
MarkableRegistrationtrue if the underlying registrable
object is marked as registered, false otherwise.hasRegistredMark in interface MarkableRegistrationpublic boolean hasSerializedResource()
SerializedResourceDatatrue 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 SerializedResourceDatapublic java.lang.Class<? extends Listener> getListenerType()
ResourceRegistrationgetListenerType in interface ResourceRegistrationpublic Resource<?> getResource()
ResourceRegistrationgetResource in interface ResourceRegistrationpublic java.lang.String getResourceName()
ResourceRegistrationgetResourceName in interface ResourceRegistrationpublic com.google.common.base.Optional<Resource<?>> getSerializedResource()
SerializedResourceDatagetSerializedResource in interface SerializedResourceDatapublic final boolean hasAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> type)
hasAnnotation in interface Annotablepublic final <A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.Class<A> type)
getAnnotation in interface Annotablepublic final java.util.List<java.lang.annotation.Annotation> getAnnotations()
getAnnotations in interface Annotable