org.gvsig.tools.persistence
Interface PersistentState

All Known Subinterfaces:
PersistentStateServices
All Known Implementing Classes:
AbstractPersistentState

public interface PersistentState


Method Summary
 Object get(String name)
          Gets an Object property.
 Object[] getArray(String name, Class valueClass)
          Returns an array whose elements are of the class given.
 boolean getBoolean(String name)
          Gets a boolean property.
 boolean[] getBooleanArray(String name)
          Returns an array whose elements are of boolean basic type.
 PersistentContext getContext()
           
 Date getDate(String name)
          Gets a Date property.
 Date[] getDateArray(String name)
          Returns an array whose elements are of Date type.
 DynStruct getDefinition()
          Returns the struct definition associated to this state
 double getDouble(String name)
          Gets a double property.
 double[] getDoubleArray(String name)
          Returns an array whose elements are of double basic type.
 File getFile(String name)
           
 float getFloat(String name)
          Gets a float property.
 float[] getFloatArray(String name)
          Returns an array whose elements are of float basic type.
 int getInt(String name)
          Gets an int property.
 int[] getIntArray(String name)
          Returns an array whose elements are of int basic type.
 Iterator getIterator(String name)
           Gets an Iterator over properties of types List, Set or Map.
 List getList(String name)
          Gets a List property.
 long getLong(String name)
          Gets an long property.
 long[] getLongArray(String name)
          Returns an array whose elements are of long basic type.
 Map getMap(String name)
          Gets a Map property.
 Iterator getNames()
          Gets an iterator over the names of the properties contained in this PersistentState.
 Set getSet(String name)
          Gets a Set property.
 String getString(String name)
          Gets a String property.
 String[] getStringArray(String name)
          Returns an array whose elements are of String type.
 String getTheClassName()
          Gets the name of the java class corresponding to this persistent state
 URI getURI(String name)
           
 URL getURL(String name)
           
 boolean hasValue(String name)
          Informs that a property is set or not.
 void set(String name, boolean value)
           Sets a property of type boolean.
 void set(String name, Boolean value)
           Sets a property of type Boolean.
 void set(String name, boolean[] value)
          Sets a property of type List with an array of boolean.
 void set(String name, Date value)
           Sets a property of type Date.
 void set(String name, Date[] value)
          Sets a property of type List with an array of Date.
 void set(String name, double value)
           Sets a property of type double.
 void set(String name, Double value)
           Sets a property of type Double.
 void set(String name, double[] value)
          Sets a property of type List with an array of double.
 void set(String name, File value)
           
 void set(String name, float value)
           Sets a property of type float.
 void set(String name, Float value)
           Sets a property of type Float.
 void set(String name, float[] value)
          Sets a property of type List with an array of float.
 void set(String name, int value)
           Sets a property of type int.
 void set(String name, int[] value)
          Sets a property of type List with an array of int.
 void set(String name, Integer value)
           Sets a property of type Integer.
 void set(String name, Iterator it)
           Sets a property of type List (like do set(String, List) ) filled with the values provided by a Iterator The items of the iteration must be persistence supported types instance.
 void set(String name, List value)
           Sets a property of type List.
 void set(String name, long value)
           Sets a property of type long.
 void set(String name, Long value)
           Sets a property of type Long.
 void set(String name, long[] value)
          Sets a property of type List with an array of long.
 void set(String name, Map value)
           Sets a property of type Map.
 void set(String name, Object value)
           Sets a property.
 void set(String name, Object[] value)
          Sets a property of type List with an array.
 void set(String name, Persistent obj)
           Sets a property of type Persistent.
 void set(String name, Set value)
           Sets a property of type Set.
 void set(String name, String value)
           Sets a property of type String.
 void set(String name, String[] value)
          Sets a property of type List with an array of String.
 void set(String name, URI value)
           
 void set(String name, URL value)
           
 void setNull(String name)
           
 

Method Detail

getTheClassName

String getTheClassName()
Gets the name of the java class corresponding to this persistent state

Returns:
The class name of the java class represented by this state

getDefinition

DynStruct getDefinition()
Returns the struct definition associated to this state

Returns:
the DynStruct definition of the state.

getContext

PersistentContext getContext()

getInt

int getInt(String name)
           throws PersistenceException
Gets an int property.

Parameters:
name - The name of the property to get
Returns:
The int property associated to the provided name
Throws:
PersistenceException

getLong

long getLong(String name)
             throws PersistenceException
Gets an long property.

Parameters:
name - The name of the property to get
Returns:
The long property associated to the provided name
Throws:
PersistenceException

getDate

Date getDate(String name)
             throws PersistenceException
Gets a Date property.

Parameters:
name -
Returns:
The Date property associated to the provided name
Throws:
PersistenceException

getDouble

double getDouble(String name)
                 throws PersistenceException
Gets a double property.

Parameters:
name - The name of the property to get
Returns:
The double property associated to the provided name
Throws:
PersistenceException

getFloat

float getFloat(String name)
               throws PersistenceException
Gets a float property.

Parameters:
name - The name of the property to get
Returns:
The float property associated to the provided name
Throws:
PersistenceException

getBoolean

boolean getBoolean(String name)
                   throws PersistenceException
Gets a boolean property.

Parameters:
name - The name of the property to get
Returns:
The boolean property associated to the provided name
Throws:
PersistenceException

getString

String getString(String name)
                 throws PersistenceException
Gets a String property.

Parameters:
name - The name of the property to get
Returns:
The String property associated to the provided name
Throws:
PersistenceException

getList

List getList(String name)
             throws PersistenceException
Gets a List 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"))

Parameters:
name - The name of the property to get
Returns:
The List property value associated to the provided name
Throws:
PersistenceException - if there is an error getting the property value

getArray

Object[] getArray(String name,
                  Class valueClass)
                  throws PersistenceException
Returns an array whose elements are of the class given. This is useful to be able to cast the returned Object[] to the real class. To be able to store and load a property as an array, the type of the property defined in the DynStruct must be List.

Ex: Color[] colors = (Color[])state.getArray("colors", Color.class);

Parameters:
name - The name of the property to get
valueClass - the class of the array elements
Returns:
the array of elements
Throws:
PersistenceException - if there is an error getting the property value

getBooleanArray

boolean[] getBooleanArray(String name)
                          throws PersistenceException
Returns an array whose elements are of boolean basic type. To be able to store and load a property as an array, the type of the property defined in the DynStruct must be List.

Parameters:
name - The name of the property to get
Returns:
the array of elements
Throws:
PersistenceException - if there is an error getting the property value

getIntArray

int[] getIntArray(String name)
                  throws PersistenceException
Returns an array whose elements are of int basic type. To be able to store and load a property as an array, the type of the property defined in the DynStruct must be List.

Parameters:
name - The name of the property to get
Returns:
the array of elements
Throws:
PersistenceException - if there is an error getting the property value

getLongArray

long[] getLongArray(String name)
                    throws PersistenceException
Returns an array whose elements are of long basic type. To be able to store and load a property as an array, the type of the property defined in the DynStruct must be List.

Parameters:
name - The name of the property to get
Returns:
the array of elements
Throws:
PersistenceException - if there is an error getting the property value

getFloatArray

float[] getFloatArray(String name)
                      throws PersistenceException
Returns an array whose elements are of float basic type. To be able to store and load a property as an array, the type of the property defined in the DynStruct must be List.

Parameters:
name - The name of the property to get
Returns:
the array of elements
Throws:
PersistenceException - if there is an error getting the property value

getDoubleArray

double[] getDoubleArray(String name)
                        throws PersistenceException
Returns an array whose elements are of double basic type. To be able to store and load a property as an array, the type of the property defined in the DynStruct must be List.

Parameters:
name - The name of the property to get
Returns:
the array of elements
Throws:
PersistenceException - if there is an error getting the property value

getDateArray

Date[] getDateArray(String name)
                    throws PersistenceException
Returns an array whose elements are of Date type. To be able to store and load a property as an array, the type of the property defined in the DynStruct must be List.

Parameters:
name -
Returns:
Throws:
PersistenceException

getStringArray

String[] getStringArray(String name)
                        throws PersistenceException
Returns an array whose elements are of String type. To be able to store and load a property as an array, the type of the property defined in the DynStruct must be List.

Parameters:
name -
Returns:
Throws:
PersistenceException

getMap

Map getMap(String name)
           throws PersistenceException
Gets a Map 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"))

Parameters:
name - The name of the property to get
Returns:
The Map property value associated to the provided name
Throws:
PersistenceException - if there is an error getting the property value

getSet

Set getSet(String name)
           throws PersistenceException
Gets a Set 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"))

Parameters:
name - The name of the property to get
Returns:
The Set property value associated to the provided name
Throws:
PersistenceException - if there is an error getting the property value

getURL

URL getURL(String name)
           throws PersistenceException
Throws:
PersistenceException

getURI

URI getURI(String name)
           throws PersistenceException
Throws:
PersistenceException

getFile

File getFile(String name)
             throws PersistenceException
Throws:
PersistenceException

get

Object get(String name)
           throws PersistenceException
Gets an Object property.

Parameters:
name - The name of the property to get
Returns:
The Object property associated to the provided name
Throws:
PersistenceException

getIterator

Iterator getIterator(String name)
                     throws PersistenceException

Gets an Iterator over properties of types List, Set or Map.

Parameters:
name - The name of the property to get
Returns:
The Iterator associated to the property value of provided name
Throws:
PersistenceException

set

void set(String name,
         String value)
         throws PersistenceException

Sets a property of type String.

Parameters:
name - The name of the property to store (must be a valid Java identifier)
it - The String object to be stored in the state.
Throws:
PersistenceException

set

void set(String name,
         File value)
         throws PersistenceException
Throws:
PersistenceException

set

void set(String name,
         URL value)
         throws PersistenceException
Throws:
PersistenceException

set

void set(String name,
         URI value)
         throws PersistenceException
Throws:
PersistenceException

set

void set(String name,
         int value)
         throws PersistenceException

Sets a property of type int.

Parameters:
name - The name of the property to store (must be a valid Java identifier)
it - The int value to be stored in the state.
Throws:
PersistenceException

set

void set(String name,
         long value)
         throws PersistenceException

Sets a property of type long.

Parameters:
name - The name of the property to store (must be a valid Java identifier)
it - The long value to be stored in the state.
Throws:
PersistenceException

set

void set(String name,
         double value)
         throws PersistenceException

Sets a property of type double.

Parameters:
name - The name of the property to store (must be a valid Java identifier)
it - The double value to be stored in the state.
Throws:
PersistenceException

set

void set(String name,
         float value)
         throws PersistenceException

Sets a property of type float.

Parameters:
name - The name of the property to store (must be a valid Java identifier)
it - The float value to be stored in the state.
Throws:
PersistenceException

set

void set(String name,
         boolean value)
         throws PersistenceException

Sets a property of type boolean.

Parameters:
name - The name of the property to store (must be a valid Java identifier)
it - The boolean value to be stored in the state.
Throws:
PersistenceException

set

void set(String name,
         Persistent obj)
         throws PersistenceException

Sets a property of type Persistent.

Parameters:
name - The name of the property to store (must be a valid Java identifier)
obj - The Persistent object to be stored in the state.
Throws:
PersistenceException

set

void set(String name,
         List value)
         throws PersistenceException

Sets a property of type List.

The items of the list must be persistence supported types instance.

get(String) return an read only List instance after #load(Reader)

Parameters:
name - The name of the property to store (must be a valid Java identifier)
value - The List object to be stored in the state.
Throws:
PersistenceException

set

void set(String name,
         Object[] value)
         throws PersistenceException
Sets a property of type List 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.

Parameters:
name - The name of the property to set
value - the value to set
Throws:
PersistenceException - if there is an error setting the property value

set

void set(String name,
         int[] value)
         throws PersistenceException
Sets a property of type List 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.

Parameters:
name - The name of the property to set
value - the value to set
Throws:
PersistenceException - if there is an error setting the property value

set

void set(String name,
         long[] value)
         throws PersistenceException
Sets a property of type List 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.

Parameters:
name - The name of the property to set
value - the value to set
Throws:
PersistenceException - if there is an error setting the property value

set

void set(String name,
         float[] value)
         throws PersistenceException
Sets a property of type List 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.

Parameters:
name - The name of the property to set
value - the value to set
Throws:
PersistenceException - if there is an error setting the property value

set

void set(String name,
         double[] value)
         throws PersistenceException
Sets a property of type List 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.

Parameters:
name - The name of the property to set
value - the value to set
Throws:
PersistenceException - if there is an error setting the property value

set

void set(String name,
         Date[] value)
         throws PersistenceException
Sets a property of type List 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.

Parameters:
name -
value - the Date array to set.
Throws:
PersistenceException

set

void set(String name,
         String[] value)
         throws PersistenceException
Sets a property of type List 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.

Parameters:
name -
value -
Throws:
PersistenceException

set

void set(String name,
         boolean[] value)
         throws PersistenceException
Sets a property of type List 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.

Parameters:
name - The name of the property to set
value - the value to set
Throws:
PersistenceException - if there is an error setting the property value

set

void set(String name,
         Set value)
         throws PersistenceException

Sets a property of type Set.

The items of the set must be persistence supported type instances.

get(String) return an read only Set instance after #load(Reader)

Parameters:
name - The name of the property to store (must be a valid Java identifier)
it - The Set object to be stored in the state.
Throws:
PersistenceException

set

void set(String name,
         Map value)
         throws PersistenceException

Sets a property of type Map.

The values and keys of the map must be persistence supported type instances.

get(String) return an read only Map instance after #load(Reader)

Parameters:
name - The name of the property to store (must be a valid Java identifier)
it - The Map object to be stored in the state.
Throws:
PersistenceException

set

void set(String name,
         Boolean value)
         throws PersistenceException

Sets a property of type Boolean.

Parameters:
name - The name of the property to store (must be a valid Java identifier)
it - The Boolean object to be stored in the state.
Throws:
PersistenceException

set

void set(String name,
         Date value)
         throws PersistenceException

Sets a property of type Date.

Parameters:
name - The name of the property to store (must be a valid Java identifier)
it - The Date object to be stored in the state.
Throws:
PersistenceException

set

void set(String name,
         Integer value)
         throws PersistenceException

Sets a property of type Integer.

Parameters:
name - The name of the property to store (must be a valid Java identifier)
it - The Integer object to be stored in the state.
Throws:
PersistenceException

set

void set(String name,
         Long value)
         throws PersistenceException

Sets a property of type Long.

Parameters:
name - The name of the property to store (must be a valid Java identifier)
it - The Long object to be stored in the state.
Throws:
PersistenceException

set

void set(String name,
         Float value)
         throws PersistenceException

Sets a property of type Float.

Parameters:
name - The name of the property to store (must be a valid Java identifier)
it - The Float object to be stored in the state.
Throws:
PersistenceException

set

void set(String name,
         Double value)
         throws PersistenceException

Sets a property of type Double.

Parameters:
name - The name of the property to store (must be a valid Java identifier)
it - The Double object to be stored in the state.
Throws:
PersistenceException

set

void set(String name,
         Iterator it)
         throws PersistenceException

Sets a property of type List (like do set(String, List) ) filled with the values provided by a Iterator

The items of the iteration must be persistence supported types instance.

Parameters:
name - The name of the property to store (must be a valid Java identifier)
it - The iterator to get values to store in the list property.
Throws:
PersistenceException
See Also:
#set(String, List)}

set

void set(String name,
         Object value)
         throws PersistenceException

Sets a property.

value must be a supported type or manager must have a PersistenceFactory that know how persist it.

Parameters:
name - The name of the property to store (must be a valid Java identifier)
it - The Float object to be stored in the state.
Throws:
PersistenceException

setNull

void setNull(String name)
             throws PersistenceException
Throws:
PersistenceException

getNames

Iterator getNames()

Gets an iterator over the names of the properties contained in this PersistentState.

Returns:
An iterator which provides the name of all the properties contained in this state.

hasValue

boolean hasValue(String name)
Informs that a property is set or not.

Parameters:
name -
Returns:


Copyright © 2004-2011 gvSIG. All Rights Reserved.