Module org.eclipse.persistence.core
Class DynamicEntityImpl
java.lang.Object
org.eclipse.persistence.internal.dynamic.DynamicEntityImpl
- All Implemented Interfaces:
ChangeTracker,DynamicEntity,PersistenceEntity,FetchGroupTracker
- Direct Known Subclasses:
XRDynamicEntity
public abstract class DynamicEntityImpl
extends Object
implements DynamicEntity, PersistenceEntity, ChangeTracker, FetchGroupTracker
This abstract class is used to represent an entity which typically is not
realized in Java code. In combination with the DynamicClassLoader ASM is used
to generate subclasses that will work within EclipseLink's framework. Since
no concrete fields or methods exist on this class the mappings used must be
customized to use a custom AttributeAccessor (
ValuesAccessor).
Type/Property Meta-model: This dynamic entity approach also includes a
meta-model facade to simplify access to the types and property information so
that clients can more easily understand the model. Each
DynamicTypeImpl wraps the underlying EclipseLink
relational-descriptor and the DynamicPropertiesManager wraps each mapping.
The client application can use these types and properties to facilitate
generic access to the entity instances and are required for creating new
instances as well as for accessing the Java class needed for JPA and
EclipseLink native API calls.
- Since:
- EclipseLink 1.2
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CacheKeyprotected Map<String, DynamicEntityImpl.PropertyWrapper> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInstantiates a new dynamic entity impl. -
Method Summary
Modifier and TypeMethodDescriptionReturn the fetch group being trackedPUBLIC: Return the PropertyChangeListener for the object.Return the session for the object.boolean_persistence_isAttributeFetched(String attribute) Return true if the attribute is in the fetch group being tracked.voidReset all attributes of the tracked object to the un-fetched state with initial default values.void_persistence_setCacheKey(CacheKey cacheKey) voidSet a fetch group to be tracked.voidvoidPUBLIC: Set the PropertyChangeListener for the object.void_persistence_setSession(Session session) Set true if the fetch group attributes should be refreshedvoid_persistence_setShouldRefreshFetchGroup(boolean shouldRefreshFetchGroup) Set true if the fetch group attributes should be refreshed.booleanReturn true if the fetch group attributes should be refreshed.abstract DynamicPropertiesManagerFetch properties manager.<T> TReturn the persistence value for the given property as the specified type.Gets the properties map.getType()Gets internal impl class ofDynamicType.booleanDiscover if a property has a persistent valueprotected voidPost construct.Set the persistence value for the given property to the specified valueSets the.toString()String representation of the dynamic entity using the entity type name and the primary key values - something like {Emp 10} or {Phone 234-5678 10}.
-
Field Details
-
propertiesMap
-
cacheKey
-
-
Constructor Details
-
DynamicEntityImpl
protected DynamicEntityImpl()Instantiates a new dynamic entity impl.
-
-
Method Details
-
fetchPropertiesManager
Fetch properties manager.- Returns:
- the dynamic properties manager
-
getPropertiesMap
Gets the properties map.- Returns:
- the properties map
-
postConstruct
protected void postConstruct()Post construct. -
getType
Gets internal impl class ofDynamicType.- Returns:
- Dynamic type of this entity
- Throws:
DynamicException- if type is null
-
get
Description copied from interface:DynamicEntityReturn the persistence value for the given property as the specified type. In the case of relationships, this call will populate lazy-loaded relationships- Specified by:
getin interfaceDynamicEntity- Type Parameters:
T- generic type of the property (if not provided, assume Object). If the property cannot be cast to the specific type, aDynamicExceptionwill be thrown.- Parameters:
propertyName- the name of a mapped property If the property cannot be found, aDynamicExceptionwill be thrown.- Returns:
- persistent value or relationship container of the specified type
- Throws:
DynamicException
-
isSet
Description copied from interface:DynamicEntityDiscover if a property has a persistent value- Specified by:
isSetin interfaceDynamicEntity- Parameters:
propertyName- the name of a mapped property If the property cannot be found, aDynamicExceptionwill be thrown.- Returns:
- true if the property has been set
- Throws:
DynamicException
-
set
Description copied from interface:DynamicEntitySet the persistence value for the given property to the specified value- Specified by:
setin interfaceDynamicEntity- Parameters:
propertyName- the name of a mapped property If the property cannot be found, aDynamicExceptionwill be thrown.value- the specified object- Returns:
- the same DynamicEntity instance
- Throws:
DynamicException
-
set
public DynamicEntity set(String propertyName, Object value, boolean firePropertyChange) throws DynamicException Sets the.- Parameters:
propertyName- the property namevalue- the valuefirePropertyChange- the fire property change- Returns:
- the dynamic entity
- Throws:
DynamicException- the dynamic exception
-
_persistence_getId
- Specified by:
_persistence_getIdin interfacePersistenceEntity
-
_persistence_setId
- Specified by:
_persistence_setIdin interfacePersistenceEntity
-
_persistence_getCacheKey
- Specified by:
_persistence_getCacheKeyin interfacePersistenceEntity
-
_persistence_setCacheKey
- Specified by:
_persistence_setCacheKeyin interfacePersistenceEntity
-
_persistence_getPropertyChangeListener
Description copied from interface:ChangeTrackerPUBLIC: Return the PropertyChangeListener for the object.- Specified by:
_persistence_getPropertyChangeListenerin interfaceChangeTracker
-
_persistence_setPropertyChangeListener
Description copied from interface:ChangeTrackerPUBLIC: Set the PropertyChangeListener for the object.- Specified by:
_persistence_setPropertyChangeListenerin interfaceChangeTracker
-
_persistence_getFetchGroup
Description copied from interface:FetchGroupTrackerReturn the fetch group being tracked- Specified by:
_persistence_getFetchGroupin interfaceFetchGroupTracker
-
_persistence_setFetchGroup
Description copied from interface:FetchGroupTrackerSet a fetch group to be tracked.- Specified by:
_persistence_setFetchGroupin interfaceFetchGroupTracker
-
_persistence_setShouldRefreshFetchGroup
public void _persistence_setShouldRefreshFetchGroup(boolean shouldRefreshFetchGroup) Description copied from interface:FetchGroupTrackerSet true if the fetch group attributes should be refreshed.- Specified by:
_persistence_setShouldRefreshFetchGroupin interfaceFetchGroupTracker
-
_persistence_shouldRefreshFetchGroup
public boolean _persistence_shouldRefreshFetchGroup()Description copied from interface:FetchGroupTrackerReturn true if the fetch group attributes should be refreshed.- Specified by:
_persistence_shouldRefreshFetchGroupin interfaceFetchGroupTracker
-
_persistence_isAttributeFetched
Return true if the attribute is in the fetch group being tracked.- Specified by:
_persistence_isAttributeFetchedin interfaceFetchGroupTracker- Parameters:
attribute- the attribute- Returns:
- true, if successful
-
_persistence_resetFetchGroup
public void _persistence_resetFetchGroup()Reset all attributes of the tracked object to the un-fetched state with initial default values.- Specified by:
_persistence_resetFetchGroupin interfaceFetchGroupTracker
-
_persistence_getSession
Description copied from interface:FetchGroupTrackerReturn the session for the object.- Specified by:
_persistence_getSessionin interfaceFetchGroupTracker
-
_persistence_setSession
Description copied from interface:FetchGroupTrackerSet true if the fetch group attributes should be refreshed- Specified by:
_persistence_setSessionin interfaceFetchGroupTracker
-
toString
String representation of the dynamic entity using the entity type name and the primary key values - something like {Emp 10} or {Phone 234-5678 10}.
-