Package net.officefloor.jpa
Class JpaManagedObjectSource.JpaManagedObject
- java.lang.Object
-
- net.officefloor.jpa.JpaManagedObjectSource.JpaManagedObject
-
- All Implemented Interfaces:
java.lang.reflect.InvocationHandler
,CoordinatingManagedObject<Indexed>
,ManagedObject
- Enclosing class:
- JpaManagedObjectSource
public class JpaManagedObjectSource.JpaManagedObject extends java.lang.Object implements CoordinatingManagedObject<Indexed>, java.lang.reflect.InvocationHandler
JPAManagedObject
.
-
-
Constructor Summary
Constructors Constructor Description JpaManagedObject()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.persistence.EntityManager
getEntityManager()
Obtains theEntityManager
.java.lang.Object
getObject()
Obtains the object being managed.java.lang.Object
invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
protected void
loadEntityManager(java.util.function.Function<java.lang.Integer,java.lang.Object> dependencyRetriever)
Loads theEntityManager
.void
loadObjects(ObjectRegistry<Indexed> registry)
Loads the Objects of theManagedObject
instances to be referenced by thisCoordinatingManagedObject
.
-
-
-
Method Detail
-
getEntityManager
public javax.persistence.EntityManager getEntityManager()
Obtains theEntityManager
.- Returns:
EntityManager
.
-
loadEntityManager
protected void loadEntityManager(java.util.function.Function<java.lang.Integer,java.lang.Object> dependencyRetriever) throws java.lang.Exception
Loads theEntityManager
.- Parameters:
dependencyRetriever
- Retrieves the dependency.- Throws:
java.lang.Exception
- If fails to load theEntityManager
.
-
loadObjects
public void loadObjects(ObjectRegistry<Indexed> registry) throws java.lang.Throwable
Description copied from interface:CoordinatingManagedObject
Loads the Objects of the
ManagedObject
instances to be referenced by thisCoordinatingManagedObject
.References to the loaded Objects must be released on recycling the
ManagedObject
.- Specified by:
loadObjects
in interfaceCoordinatingManagedObject<Indexed>
- Parameters:
registry
- Registry of the Objects for theManagedObject
instances.- Throws:
java.lang.Throwable
- Should thisCoordinatingManagedObject
fail to load theManagedObject
.
-
getObject
public java.lang.Object getObject() throws java.lang.Throwable
Description copied from interface:ManagedObject
Obtains the object being managed.- Specified by:
getObject
in interfaceManagedObject
- Returns:
- Object being managed.
- Throws:
java.lang.Throwable
- Indicating failed to obtain the object for use.
-
invoke
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
- Specified by:
invoke
in interfacejava.lang.reflect.InvocationHandler
- Throws:
java.lang.Throwable
-
-