org.gvsig.tools.persistence
Interface PersistenceFactory

All Known Implementing Classes:
AbstractMultiPersistenceFactory, AbstractSinglePersistenceFactory, DynObjectPersistenceFactory, SimplePersistenceFactory

public interface PersistenceFactory

Interface for factories of objects that no implements Persistent and must be supported by PersistenceManager.

This can be used when the objects to persist can't be created by empty constructor.

Author:
jmvivo

Method Summary
 Object createFromState(PersistentState state)
          Create an instance of the object represented by the state.
 DynStruct getDefinition(String className)
          Returns the associated definition to the java class name
 List getDefinitions()
          Return a List of the definition managed by this factory where the key is className and value is definition
 String getDomainName()
          Returns the domain name of the objects persisted by this factory.
 String getDomainURL()
          Returns the domain URL to use for the schema.
 Class getManagedClass(Object object)
          Return the class or interface the factory asociate to the object.
 Class getManagedClass(PersistentState state)
          Return the class or interface the factory asociate to the object.
 Class getManagedClass(String name)
          Return the class or interface the factory asociate to the java class name.
 List getManagedClasses()
          Return the list of classes or interfaces managed by this factory.
 String getManagedClassName(Object object)
          Return the name class or interface the factory asociate to the object.
 void loadFromState(PersistentState state, Object object)
          Load a instance of classToUse from state data.
 boolean manages(Class theClass)
          Informs if theClass is managed by this factory.
 boolean manages(Object object)
          Informs if object is managed by this factory.
 boolean manages(PersistentState state)
          Informs if this factory can recreate the object represented by state.
 void saveToState(PersistentState state, Object obj)
          Fill state with data to persist of obj.
 

Method Detail

createFromState

Object createFromState(PersistentState state)
                       throws PersistenceException
Create an instance of the object represented by the state. This method can't call loadFromState(PersistentState, Object) only create the object.

Parameters:
state -
Returns:
the object
Throws:
PersistenceException

loadFromState

void loadFromState(PersistentState state,
                   Object object)
                   throws PersistenceException
Load a instance of classToUse from state data.

Parameters:
state -
object -
Throws:
PersistenceException

saveToState

void saveToState(PersistentState state,
                 Object obj)
                 throws PersistenceException
Fill state with data to persist of obj.

Parameters:
state -
obj -
Throws:
PersistenceException

manages

boolean manages(Object object)
Informs if object is managed by this factory.

Parameters:
object -
Returns:
true if the object is managed by the factory.

manages

boolean manages(Class theClass)
Informs if theClass is managed by this factory.

Parameters:
class - to check.
Returns:
true if the class is managed by the factory.

manages

boolean manages(PersistentState state)
Informs if this factory can recreate the object represented by state.

Parameters:
object -
Returns:

getDefinitions

List getDefinitions()
Return a List of the definition managed by this factory where the key is className and value is definition

Returns:
Map

getDefinition

DynStruct getDefinition(String className)
Returns the associated definition to the java class name

Parameters:
className - of a java Class
Returns:
the related definition or null if not managed by this factory

getDomainName

String getDomainName()
Returns the domain name of the objects persisted by this factory.

Returns:
the domain name

getDomainURL

String getDomainURL()
Returns the domain URL to use for the schema.

Returns:
the domain URL

getManagedClasses

List getManagedClasses()
Return the list of classes or interfaces managed by this factory. Can return null if factory not use it.

Returns:
List of interfaces the factory manage

getManagedClass

Class getManagedClass(Object object)
Return the class or interface the factory asociate to the object. Can return null if factory not asociate an interface to the object.

Parameters:
object -
Returns:
interface the factory manage asociated to the object.

getManagedClassName

String getManagedClassName(Object object)
Return the name class or interface the factory asociate to the object. Can return null if factory not asociate an interface to the object.

Parameters:
object -
Returns:
interface the factory manage asociated to the object.

getManagedClass

Class getManagedClass(PersistentState state)
Return the class or interface the factory asociate to the object. Can return null if factory not asociate an interface to the object.

Parameters:
state -
Returns:
interface or class the factory manage asociated to the state.

getManagedClass

Class getManagedClass(String name)
Return the class or interface the factory asociate to the java class name. Can return null if factory not asociate an interface to that name.

Parameters:
name -
Returns:
interface or class the factory manage asociated to the name.


Copyright © 2004-2011 gvSIG. All Rights Reserved.