- java.lang.Object
-
- org.eclipse.persistence.tools.schemaframework.PopulationManager
-
public class PopulationManager extends Object
Purpose: This class is used to populate example data into the database, it allows for circular references to be resolved.
Responsibilities:
- Allow objects to be registered.
- Allow objects to be looked up.
- Store a globally accessible default instance.
-
-
Field Summary
Fields Modifier and Type Field Description protected static PopulationManager
defaultManager
Store the default instance.protected Map<Class<?>,Map<String,Object>>
registeredObjects
Store the objects registered.
-
Constructor Summary
Constructors Constructor Description PopulationManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAllObjectsForAbstractClass(Class<?> objectsClass, org.eclipse.persistence.internal.sessions.AbstractSession session, Vector<Object> allObjects)
Add all of the objects of the class and all of its subclasses.void
addAllObjectsForAbstractClass(Class<?> objectsClass, Session session, Vector<Object> allObjects)
Add all of the objects of the class and all of its subclasses.void
addAllObjectsForClass(Class<?> objectsClass, List<Object> allObjects)
Add all of the objects of the class.boolean
containsObject(Class<?> objectsClass, String objectsName)
Check if the object is registered given its name.boolean
containsObject(Object objectToCheck, String objectsName)
Check if the object is registered given its name.List<Class<?>>
getAllClasses()
Return all of the objects registered.Vector<Object>
getAllObjects()
Return all of the objects registered.List<Object>
getAllObjectsForAbstractClass(Class<?> objectsClass)
Return all of the objects of the class and all of its subclasses.List<Object>
getAllObjectsForAbstractClass(Class<?> objectsClass, org.eclipse.persistence.internal.sessions.AbstractSession session)
Return all of the objects of the class and all of its subclasses.Vector<Object>
getAllObjectsForClass(Class<?> objectsClass)
Return all of the objects of the class.static PopulationManager
getDefaultManager()
Lazy initialize the default instance.Object
getObject(Class<?> objectsClass, String objectsName)
Return the object registered given its name.Map<Class<?>,Map<String,Object>>
getRegisteredObjects()
Return the registered objects.Object
registerObject(Class<?> javaClass, Object objectToRegister, String objectsName)
Register the object given its name.Object
registerObject(Object objectToRegister, String objectsName)
Register the object given its name.void
removeObject(Class<?> classToRemove, String objectsName)
Remove the object given its class and name.Object
removeObject(Object objectToRemove, String objectsName)
Remove the object given its name.static void
resetDefaultManager()
Reset the default instance.static void
setDefaultManager(PopulationManager theDefaultManager)
Set the default instance.void
setRegisteredObjects(Map<Class<?>,Map<String,Object>> registeredObjects)
Set the registered objects.
-
-
-
Method Detail
-
addAllObjectsForAbstractClass
public void addAllObjectsForAbstractClass(Class<?> objectsClass, org.eclipse.persistence.internal.sessions.AbstractSession session, Vector<Object> allObjects)
Add all of the objects of the class and all of its subclasses. The session is needed because there is no other way to find all subclasses.
-
addAllObjectsForAbstractClass
public void addAllObjectsForAbstractClass(Class<?> objectsClass, Session session, Vector<Object> allObjects)
Add all of the objects of the class and all of its subclasses. The session is needed because there is no other way to find all subclasses.
-
addAllObjectsForClass
public void addAllObjectsForClass(Class<?> objectsClass, List<Object> allObjects)
Add all of the objects of the class.
-
containsObject
public boolean containsObject(Class<?> objectsClass, String objectsName)
Check if the object is registered given its name.
-
containsObject
public boolean containsObject(Object objectToCheck, String objectsName)
Check if the object is registered given its name.
-
getAllObjectsForAbstractClass
public List<Object> getAllObjectsForAbstractClass(Class<?> objectsClass)
Return all of the objects of the class and all of its subclasses.
-
getAllObjectsForAbstractClass
public List<Object> getAllObjectsForAbstractClass(Class<?> objectsClass, org.eclipse.persistence.internal.sessions.AbstractSession session)
Return all of the objects of the class and all of its subclasses. The session is needed because there is no other way to find all subclasses.
-
getAllObjectsForClass
public Vector<Object> getAllObjectsForClass(Class<?> objectsClass)
Return all of the objects of the class.
-
getDefaultManager
public static PopulationManager getDefaultManager()
Lazy initialize the default instance.
-
getObject
public Object getObject(Class<?> objectsClass, String objectsName)
Return the object registered given its name.
-
getRegisteredObjects
public Map<Class<?>,Map<String,Object>> getRegisteredObjects()
Return the registered objects.
-
registerObject
public Object registerObject(Class<?> javaClass, Object objectToRegister, String objectsName)
Register the object given its name. The objects are represented as a hashtable of hashtables, lazy initialized on the class.
-
registerObject
public Object registerObject(Object objectToRegister, String objectsName)
Register the object given its name. The objects are represented as a hashtable of hashtables, lazy initialized on the class.
-
removeObject
public void removeObject(Class<?> classToRemove, String objectsName)
Remove the object given its class and name.
-
removeObject
public Object removeObject(Object objectToRemove, String objectsName)
Remove the object given its name.
-
resetDefaultManager
public static void resetDefaultManager()
Reset the default instance.
-
setDefaultManager
public static void setDefaultManager(PopulationManager theDefaultManager)
Set the default instance.
-
-