|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IStatefulObject
Special sub-interface for all objects which are to be persisted by an IStoreProvider
.
The methods are used to extract and restore the internal state of an object.
IStoreProvider
,
ICloneObjectExtensionStatefulObject
Method Summary | |
---|---|
java.lang.String |
getPersistenceClassIdentifier()
Returns a string which uniquely identifies the object type. |
java.lang.String |
getPersistenceObjectIdentifier()
Returns a key which corresponds to an entry in the state Map returned by getState() which uniquely identifies an object instance. |
java.util.Map<java.lang.String,java.lang.Comparable<? extends java.lang.Object>> |
getState()
Returns a map which fully describes the internal state of this object. |
java.util.Map<java.lang.String,java.lang.Class<? extends java.lang.Object>> |
getStateTypes()
Returns a list of all keys which are needed to persist this objects internal state. |
void |
setState(java.util.Map<java.lang.String,java.lang.Comparable<? extends java.lang.Object>> state)
Restores the internal state of this object to the state which was extracted by means of getState() earlier. |
Method Detail |
---|
java.lang.String getPersistenceClassIdentifier()
For the default ICloneObject
sub interfaces the return values must equal
the PERSISTENCE_CLASS_IDENTIFIER constant defined in the interface.
3rd party clone objects can define their own persistence identifiers.
Allowed are only letters, numbers and the underscore. Furthermore
an identifier needs to contain at least one letter, may not begin with an underscore
and may not contain multiple consecutive underscores.
A typical store provider will use this method to derive directory/file or table names.
java.lang.String getPersistenceObjectIdentifier()
For the default ICloneObject
sub interfaces the return values must equal
the PERSISTENCE_OBJECT_IDENTIFIER constant defined in the ICloneObject
interface.
By default this is uuid.
3rd party clone objects can define their own persistence identifiers.
Allowed are only letters, numbers and the underscore. Furthermore
an identifier needs to contain at least one letter, may not begin with an underscore
and may not contain multiple consecutive underscores.
A typical store provider will use this method to derive file names, internal id structure names or table primary keys.
IMPORTANT: the corresponding value in getState()
must not be changed at any point.
The unique identifiers of all stateful objects must remain unchanged during their entire lifetime.
getState()
java.util.Map<java.lang.String,java.lang.Comparable<? extends java.lang.Object>> getState()
IStoreProvider
and the setState() method is used to restore a persisted state.
In case of an ICloneObject
, the map does not include any data for
ICloneObjectExtension
which are stored under the object.
The values in the map are restricted to the following object types:
getPersistenceObjectIdentifier()
entry in this state map must always be defined
and its value may not change during the lifetime of a stateful object.
setState(Map)
void setState(java.util.Map<java.lang.String,java.lang.Comparable<? extends java.lang.Object>> state)
For a description of the internal structure of the map, see getState().
state
- a map describing the internal state of this object, never nullgetState()
java.util.Map<java.lang.String,java.lang.Class<? extends java.lang.Object>> getStateTypes()
I.e. if getState() will return a Map which contains the key "uuid" with the value "jda83ds-..." then this Map contains the key "uuid" with the value String.class.
getState()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |