public abstract class AbstractPersistentState extends java.lang.Object implements PersistentStateServices
| Constructor and Description |
|---|
AbstractPersistentState(PersistenceManagerServices manager,
PersistentContextServices context,
PersistentIdentifier id) |
| Modifier and Type | Method and Description |
|---|---|
void |
derelativizeFiles(java.io.File rootFolder)
Make absolutes all files, urls and uris that are in this state from the
folder specified.
|
java.lang.Object |
get(java.lang.String name)
Gets an
Object property. |
java.lang.Object[] |
getArray(java.lang.String name,
java.lang.Class valueClass)
Returns an array whose elements are of the class given.
|
boolean |
getBoolean(java.lang.String name)
Gets a
boolean property. |
boolean |
getBoolean(java.lang.String name,
boolean defaultValue) |
boolean[] |
getBooleanArray(java.lang.String name)
Returns an array whose elements are of boolean basic type.
|
PersistentContext |
getContext() |
java.util.Date |
getDate(java.lang.String name)
Gets a
Date property. |
java.util.Date[] |
getDateArray(java.lang.String name)
Returns an array whose elements are of Date type.
|
DynStruct |
getDefinition()
Returns the struct definition associated to this state
|
double |
getDouble(java.lang.String name)
Gets a
double property. |
double |
getDouble(java.lang.String name,
double defaultValue) |
double[] |
getDoubleArray(java.lang.String name)
Returns an array whose elements are of double basic type.
|
java.io.File |
getFile(java.lang.String name) |
float |
getFloat(java.lang.String name)
Gets a
float property. |
float |
getFloat(java.lang.String name,
float defaultValue) |
float[] |
getFloatArray(java.lang.String name)
Returns an array whose elements are of float basic type.
|
PersistentIdentifier |
getId() |
int |
getInt(java.lang.String name)
Gets an
int property. |
int |
getInt(java.lang.String name,
int defaultValue) |
int[] |
getIntArray(java.lang.String name)
Returns an array whose elements are of int basic type.
|
java.util.Iterator |
getIterator(java.lang.String name)
Gets an
Iterator over properties of types List,
Set or Map. |
java.util.List |
getList(java.lang.String name)
Gets a
List property. |
long |
getLong(java.lang.String name)
Gets an
long property. |
long |
getLong(java.lang.String name,
long defaultValue) |
long[] |
getLongArray(java.lang.String name)
Returns an array whose elements are of long basic type.
|
java.util.Map |
getMap(java.lang.String name)
Gets a
Map property. |
java.util.Iterator |
getNames()
Gets an iterator over the names of the properties contained in this
PersistentState.
|
protected java.lang.Object |
getObjectToPersist(java.lang.Object theOriginal) |
java.util.Set |
getSet(java.lang.String name)
Gets a
Set property. |
java.lang.String |
getString(java.lang.String name)
Gets a
String property. |
java.lang.String[] |
getStringArray(java.lang.String name)
Returns an array whose elements are of String type.
|
java.lang.String |
getTheClassName()
Gets the name of the java class corresponding to this persistent state
|
java.net.URI |
getURI(java.lang.String name) |
java.net.URL |
getURL(java.lang.String name) |
java.lang.Object |
getValue(java.lang.String name)
Return the internal value stored in the state associated to the
name passed as parameter.
|
boolean |
hasValue(java.lang.String name)
Informs that a property is set or not.
|
boolean |
isNull(java.lang.String name) |
void |
relativizeFiles(java.io.File rootFolder)
Make relatives all files, urls and uris that are in this state from the
folder specified.
|
void |
set(java.lang.String name,
boolean value)
Sets a property of type boolean.
|
void |
set(java.lang.String name,
java.lang.Boolean obj)
Sets a property of type
Boolean. |
void |
set(java.lang.String name,
boolean[] value)
Sets a property of type
List with an array of boolean. |
void |
set(java.lang.String name,
java.util.Date obj)
Sets a property of type
Date. |
void |
set(java.lang.String name,
java.util.Date[] values)
Sets a property of type
List with an array of Date. |
void |
set(java.lang.String name,
double value)
Sets a property of type double.
|
void |
set(java.lang.String name,
java.lang.Double obj)
Sets a property of type
Double. |
void |
set(java.lang.String name,
double[] value)
Sets a property of type
List with an array of double. |
void |
set(java.lang.String name,
java.io.File value) |
void |
set(java.lang.String name,
float value)
Sets a property of type float.
|
void |
set(java.lang.String name,
java.lang.Float obj)
Sets a property of type
Float. |
void |
set(java.lang.String name,
float[] value)
Sets a property of type
List with an array of float. |
void |
set(java.lang.String name,
int value)
Sets a property of type int.
|
void |
set(java.lang.String name,
int[] value)
Sets a property of type
List with an array of int. |
void |
set(java.lang.String name,
java.lang.Integer obj)
Sets a property of type
Integer. |
void |
set(java.lang.String name,
java.util.Iterator obj)
Sets a property of type
List (like do
PersistentState.set(String, List) ) filled with the values provided by a
Iterator
The items of the iteration must be persistence supported types instance. |
void |
set(java.lang.String name,
java.util.List obj)
Sets a property of type
List. |
void |
set(java.lang.String name,
long value)
Sets a property of type long.
|
void |
set(java.lang.String name,
java.lang.Long obj)
Sets a property of type
Long. |
void |
set(java.lang.String name,
long[] value)
Sets a property of type
List with an array of long. |
void |
set(java.lang.String name,
java.util.Map obj)
Sets a property of type
Map. |
void |
set(java.lang.String name,
java.lang.Object obj)
Sets a property.
|
void |
set(java.lang.String name,
java.lang.Object[] values)
Sets a property of type
List with an array. |
void |
set(java.lang.String name,
Persistent obj)
Sets a property of type Persistent.
|
void |
set(java.lang.String name,
java.util.Set obj)
Sets a property of type
Set. |
void |
set(java.lang.String name,
java.lang.String value)
Sets a property of type String.
|
void |
set(java.lang.String name,
java.lang.String[] values)
Sets a property of type
List with an array of String. |
void |
set(java.lang.String name,
java.net.URI value) |
void |
set(java.lang.String name,
java.net.URL value) |
void |
setFactory(PersistenceFactory factory) |
void |
setNull(java.lang.String name) |
void |
setTheClassName(java.lang.String className) |
void |
setValue(java.lang.String name,
java.lang.Object value) |
public AbstractPersistentState(PersistenceManagerServices manager, PersistentContextServices context, PersistentIdentifier id)
public void setFactory(PersistenceFactory factory)
setFactory in interface PersistentStateServicespublic DynStruct getDefinition()
PersistentStategetDefinition in interface PersistentStatepublic java.lang.Object get(java.lang.String name)
throws PersistenceException
PersistentStateObject property.get in interface PersistentStatename - The name of the property to getObject property associated to the provided namePersistenceExceptionpublic boolean isNull(java.lang.String name)
isNull in interface PersistentStatepublic java.util.List getList(java.lang.String name)
throws PersistenceException
PersistentStateList property.
Don't use the returned List as it is, as it may not work as you
expect. Instead, choose you own implementation and do something
like:
List myAttribute = new ArrayList(state.getList("prop"))
getList in interface PersistentStatename - The name of the property to getList property value associated to the provided namePersistenceException - if there is an error getting the property
valuepublic java.util.Map getMap(java.lang.String name)
throws PersistenceException
PersistentStateMap property. Don't use the returned Map as is, as
it may not be a real usable Map implementation.
Don't use the returned Map as it is, as it may not work as you
expect. Instead, choose you own implementation and do something
like:
Map myAttribute = new HashMap(state.getSet("prop"))
getMap in interface PersistentStatename - The name of the property to getMap property value associated to the provided namePersistenceException - if there is an error getting the property
valuepublic java.util.Set getSet(java.lang.String name)
throws PersistenceException
PersistentStateSet property.
Don't use the returned Set as it is, as it may not work as you
expect. Instead, choose you own implementation and do something
like:
Set myAttribute = new HashSet(state.getSet("prop"))
getSet in interface PersistentStatename - The name of the property to getSet property value associated to the provided namePersistenceException - if there is an error getting the property
valuepublic boolean getBoolean(java.lang.String name)
throws PersistenceException
PersistentStateboolean property.getBoolean in interface PersistentStatename - The name of the property to getboolean property associated to the provided namePersistenceExceptionpublic double getDouble(java.lang.String name)
throws PersistenceException
PersistentStatedouble property.getDouble in interface PersistentStatename - The name of the property to getdouble property associated to the provided namePersistenceExceptionpublic java.io.File getFile(java.lang.String name)
throws PersistenceException
getFile in interface PersistentStatePersistenceExceptionpublic java.net.URL getURL(java.lang.String name)
throws PersistenceException
getURL in interface PersistentStatePersistenceExceptionpublic java.net.URI getURI(java.lang.String name)
throws PersistenceException
getURI in interface PersistentStatePersistenceExceptionpublic java.util.Date getDate(java.lang.String name)
throws PersistenceException
PersistentStateDate property.getDate in interface PersistentStateDate property associated to the provided namePersistenceExceptionpublic float getFloat(java.lang.String name)
throws PersistenceException
PersistentStatefloat property.getFloat in interface PersistentStatename - The name of the property to getfloat property associated to the provided namePersistenceExceptionpublic int getInt(java.lang.String name)
throws PersistenceException
PersistentStateint property.getInt in interface PersistentStatename - The name of the property to getint property associated to the provided namePersistenceExceptionpublic java.util.Iterator getIterator(java.lang.String name)
throws PersistenceException
PersistentState
Gets an Iterator over properties of types List,
Set or Map.
getIterator in interface PersistentStatename - The name of the property to getIterator associated to the property value of
provided namePersistenceExceptionpublic long getLong(java.lang.String name)
throws PersistenceException
PersistentStatelong property.getLong in interface PersistentStatename - The name of the property to getlong property associated to the provided namePersistenceExceptionpublic java.lang.Object[] getArray(java.lang.String name,
java.lang.Class valueClass)
throws PersistenceException
PersistentStateDynStruct must be List.
Ex:
Color[] colors = (Color[])state.getArray("colors", Color.class);
getArray in interface PersistentStatename - The name of the property to getvalueClass - the class of the array elementsPersistenceException - if there is an error getting the property
valuepublic boolean[] getBooleanArray(java.lang.String name)
throws PersistenceException
PersistentStateDynStruct must be List.getBooleanArray in interface PersistentStatename - The name of the property to getPersistenceException - if there is an error getting the property
valuepublic int[] getIntArray(java.lang.String name)
throws PersistenceException
PersistentStateDynStruct must be List.getIntArray in interface PersistentStatename - The name of the property to getPersistenceException - if there is an error getting the property
valuepublic long[] getLongArray(java.lang.String name)
throws PersistenceException
PersistentStateDynStruct must be List.getLongArray in interface PersistentStatename - The name of the property to getPersistenceException - if there is an error getting the property
valuepublic float[] getFloatArray(java.lang.String name)
throws PersistenceException
PersistentStateDynStruct must be List.getFloatArray in interface PersistentStatename - The name of the property to getPersistenceException - if there is an error getting the property
valuepublic double[] getDoubleArray(java.lang.String name)
throws PersistenceException
PersistentStateDynStruct must be List.getDoubleArray in interface PersistentStatename - The name of the property to getPersistenceException - if there is an error getting the property
valuepublic java.util.Date[] getDateArray(java.lang.String name)
throws PersistenceException
PersistentStateDynStruct must be List.getDateArray in interface PersistentStatePersistenceExceptionpublic java.lang.String[] getStringArray(java.lang.String name)
throws PersistenceException
PersistentStateDynStruct must be List.getStringArray in interface PersistentStatePersistenceExceptionpublic java.util.Iterator getNames()
PersistentStateGets an iterator over the names of the properties contained in this PersistentState.
getNames in interface PersistentStatepublic java.lang.String getString(java.lang.String name)
throws PersistenceException
PersistentStateString property.getString in interface PersistentStatename - The name of the property to getString property associated to the provided namePersistenceExceptionpublic void setNull(java.lang.String name)
throws PersistenceException
setNull in interface PersistentStatePersistenceExceptionpublic void set(java.lang.String name,
java.lang.String value)
throws PersistenceException
PersistentStateSets a property of type String.
set in interface PersistentStatename - The name of the property to store (must be a valid Java
identifier)PersistenceExceptionpublic void set(java.lang.String name,
java.io.File value)
throws PersistenceException
set in interface PersistentStatePersistenceExceptionpublic void set(java.lang.String name,
java.net.URL value)
throws PersistenceException
set in interface PersistentStatePersistenceExceptionpublic void set(java.lang.String name,
java.net.URI value)
throws PersistenceException
set in interface PersistentStatePersistenceExceptionpublic void set(java.lang.String name,
int value)
throws PersistenceException
PersistentStateSets a property of type int.
set in interface PersistentStatename - The name of the property to store (must be a valid Java
identifier)PersistenceExceptionpublic void set(java.lang.String name,
long value)
throws PersistenceException
PersistentStateSets a property of type long.
set in interface PersistentStatename - The name of the property to store (must be a valid Java
identifier)PersistenceExceptionpublic void set(java.lang.String name,
double value)
throws PersistenceException
PersistentStateSets a property of type double.
set in interface PersistentStatename - The name of the property to store (must be a valid Java
identifier)PersistenceExceptionpublic void set(java.lang.String name,
float value)
throws PersistenceException
PersistentStateSets a property of type float.
set in interface PersistentStatename - The name of the property to store (must be a valid Java
identifier)PersistenceExceptionpublic void set(java.lang.String name,
boolean value)
throws PersistenceException
PersistentStateSets a property of type boolean.
set in interface PersistentStatename - The name of the property to store (must be a valid Java
identifier)PersistenceExceptionpublic void set(java.lang.String name,
Persistent obj)
throws PersistenceException
PersistentStateSets a property of type Persistent.
set in interface PersistentStatename - The name of the property to store (must be a valid Java
identifier)obj - The Persistent object to be stored in the state.PersistenceExceptionpublic void set(java.lang.String name,
java.lang.Object obj)
throws PersistenceException
PersistentStateSets a property.
value must be a supported type or manager must have a
PersistenceFactory that know how persist it.
set in interface PersistentStatename - The name of the property to store (must be a valid Java
identifier)PersistenceExceptionpublic void set(java.lang.String name,
java.util.Map obj)
throws PersistenceException
PersistentState
Sets a property of type Map.
The values and keys of the map must be persistence supported type instances.
PersistentState.get(String) return an read only Map instance after
#load(Reader)
set in interface PersistentStatename - The name of the property to store (must be a valid Java
identifier)PersistenceExceptionpublic void set(java.lang.String name,
java.util.List obj)
throws PersistenceException
PersistentState
Sets a property of type List.
The items of the list must be persistence supported types instance.
PersistentState.get(String) return an read only List instance after
#load(Reader)
set in interface PersistentStatename - The name of the property to store (must be a valid Java
identifier)obj - The List object to be stored in the state.PersistenceExceptionpublic void set(java.lang.String name,
java.util.Iterator obj)
throws PersistenceException
PersistentState
Sets a property of type List (like do
PersistentState.set(String, List) ) filled with the values provided by a
Iterator
The items of the iteration must be persistence supported types instance.
set in interface PersistentStatename - The name of the property to store (must be a valid Java
identifier)obj - The iterator to get values to store in the list property.PersistenceException#set(String, List)}public void set(java.lang.String name,
java.lang.Object[] values)
throws PersistenceException
PersistentStateList with an array. To be able to store
and load a property as an array, the type of the property defined in the
DynStruct must be List.set in interface PersistentStatename - The name of the property to setvalues - the value to setPersistenceException - if there is an error setting the property
valuepublic void set(java.lang.String name,
java.util.Date[] values)
throws PersistenceException
PersistentStateList with an array of Date.
To be able to store and load a property as an array, the type of the
property defined in the DynStruct must be List.set in interface PersistentStatevalues - the Date array to set.PersistenceExceptionpublic void set(java.lang.String name,
java.lang.String[] values)
throws PersistenceException
PersistentStateList with an array of String.
To be able to store and load a property as an array, the type of the
property defined in the DynStruct must be List.set in interface PersistentStatePersistenceExceptionpublic void set(java.lang.String name,
boolean[] value)
throws PersistenceException
PersistentStateList with an array of boolean. To be able
to store and load a property as an array, the type of the property
defined in the DynStruct must be List.set in interface PersistentStatename - The name of the property to setvalue - the value to setPersistenceException - if there is an error setting the property
valuepublic void set(java.lang.String name,
int[] value)
throws PersistenceException
PersistentStateList with an array of int. To be able to
store and load a property as an array, the type of the property defined
in the DynStruct must be List.set in interface PersistentStatename - The name of the property to setvalue - the value to setPersistenceException - if there is an error setting the property
valuepublic void set(java.lang.String name,
long[] value)
throws PersistenceException
PersistentStateList with an array of long. To be able to
store and load a property as an array, the type of the property defined
in the DynStruct must be List.set in interface PersistentStatename - The name of the property to setvalue - the value to setPersistenceException - if there is an error setting the property
valuepublic void set(java.lang.String name,
float[] value)
throws PersistenceException
PersistentStateList with an array of float. To be able
to store and load a property as an array, the type of the property
defined in the DynStruct must be List.set in interface PersistentStatename - The name of the property to setvalue - the value to setPersistenceException - if there is an error setting the property
valuepublic void set(java.lang.String name,
double[] value)
throws PersistenceException
PersistentStateList with an array of double. To be able
to store and load a property as an array, the type of the property
defined in the DynStruct must be List.set in interface PersistentStatename - The name of the property to setvalue - the value to setPersistenceException - if there is an error setting the property
valuepublic void set(java.lang.String name,
java.util.Set obj)
throws PersistenceException
PersistentState
Sets a property of type Set.
The items of the set must be persistence supported type instances.
PersistentState.get(String) return an read only Set instance after
#load(Reader)
set in interface PersistentStatename - The name of the property to store (must be a valid Java
identifier)PersistenceExceptionpublic void set(java.lang.String name,
java.lang.Boolean obj)
throws PersistenceException
PersistentState
Sets a property of type Boolean.
set in interface PersistentStatename - The name of the property to store (must be a valid Java
identifier)PersistenceExceptionpublic void set(java.lang.String name,
java.lang.Integer obj)
throws PersistenceException
PersistentState
Sets a property of type Integer.
set in interface PersistentStatename - The name of the property to store (must be a valid Java
identifier)PersistenceExceptionpublic void set(java.lang.String name,
java.lang.Long obj)
throws PersistenceException
PersistentState
Sets a property of type Long.
set in interface PersistentStatename - The name of the property to store (must be a valid Java
identifier)PersistenceExceptionpublic void set(java.lang.String name,
java.lang.Float obj)
throws PersistenceException
PersistentState
Sets a property of type Float.
set in interface PersistentStatename - The name of the property to store (must be a valid Java
identifier)PersistenceExceptionpublic void set(java.lang.String name,
java.lang.Double obj)
throws PersistenceException
PersistentState
Sets a property of type Double.
set in interface PersistentStatename - The name of the property to store (must be a valid Java
identifier)PersistenceExceptionpublic void set(java.lang.String name,
java.util.Date obj)
throws PersistenceException
PersistentState
Sets a property of type Date.
set in interface PersistentStatename - The name of the property to store (must be a valid Java
identifier)PersistenceExceptionprotected java.lang.Object getObjectToPersist(java.lang.Object theOriginal)
throws PersistenceException
PersistenceExceptionpublic PersistentIdentifier getId()
getId in interface PersistentStateServicespublic void setValue(java.lang.String name,
java.lang.Object value)
throws PersistenceException
setValue in interface PersistentStateServicesPersistenceExceptionpublic java.lang.String getTheClassName()
PersistentStategetTheClassName in interface PersistentStatepublic void setTheClassName(java.lang.String className)
setTheClassName in interface PersistentStateServicespublic PersistentContext getContext()
getContext in interface PersistentStatepublic boolean hasValue(java.lang.String name)
PersistentStatehasValue in interface PersistentStatepublic java.lang.Object getValue(java.lang.String name)
PersistentStateServicesgetValue in interface PersistentStateServicespublic void relativizeFiles(java.io.File rootFolder)
PersistentStaterelativizeFiles in interface PersistentStatepublic void derelativizeFiles(java.io.File rootFolder)
PersistentStatederelativizeFiles in interface PersistentStatepublic int getInt(java.lang.String name,
int defaultValue)
throws PersistenceException
getInt in interface PersistentStatePersistenceExceptionpublic long getLong(java.lang.String name,
long defaultValue)
throws PersistenceException
getLong in interface PersistentStatePersistenceExceptionpublic double getDouble(java.lang.String name,
double defaultValue)
throws PersistenceException
getDouble in interface PersistentStatePersistenceExceptionpublic float getFloat(java.lang.String name,
float defaultValue)
throws PersistenceException
getFloat in interface PersistentStatePersistenceExceptionpublic boolean getBoolean(java.lang.String name,
boolean defaultValue)
throws PersistenceException
getBoolean in interface PersistentStatePersistenceException