Class MetamodelImpl
- java.lang.Object
-
- org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl
-
- All Implemented Interfaces:
java.io.Serializable,javax.persistence.metamodel.Metamodel
public class MetamodelImpl extends java.lang.Object implements javax.persistence.metamodel.Metamodel, java.io.SerializablePurpose: Provides the implementation for the Metamodel interface of the JPA 2.0 Metamodel API (part of the JSR-317 EJB 3.1 Criteria API)
Description: Provides access to the metamodel of persistent Entities, MappedSuperclasses, Embeddables, ManagedTypes and Types in the persistence unit. Note: Since the types Map is lazy-loaded with key:value pairs - the designer and especially the user must realized that a particular BasicType may not be in the Map until it is referenced.
- Since:
- EclipseLink 1.2 - JPA 2.0
- See Also:
Metamodel, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.ClassDEFAULT_ELEMENT_TYPE_FOR_UNSUPPORTED_MAPPINGSDefault elementType Class when we the type cannot be determined for unsupported mappings such as Transformation and VariableOneToOne
-
Constructor Summary
Constructors Constructor Description MetamodelImpl(javax.persistence.EntityManager em)MetamodelImpl(javax.persistence.EntityManagerFactory emf)MetamodelImpl(EntityManagerSetupImpl emSetupImpl)INTERNAL:MetamodelImpl(org.eclipse.persistence.internal.sessions.AbstractSession session)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <X> javax.persistence.metamodel.EmbeddableType<X>embeddable(java.lang.Class<X> clazz)Return the metamodel embeddable type representing the embeddable class.<X> javax.persistence.metamodel.EntityType<X>entity(java.lang.Class<X> clazz)Return the metamodel entity type representing the entity.java.util.List<javax.persistence.metamodel.Attribute>getAllManagedTypeAttributes()INTERNAL: Return a List of all attributes for all ManagedTypes.java.util.Set<javax.persistence.metamodel.EmbeddableType<?>>getEmbeddables()Return the metamodel embeddable types.java.util.Set<javax.persistence.metamodel.EntityType<?>>getEntities()Return the metamodel entity types.java.util.Set<javax.persistence.metamodel.ManagedType<?>>getManagedTypes()Return the metamodel managed types.java.util.Map<java.lang.String,ManagedTypeImpl<?>>getManagedTypesMap()Return the metamodel managed types map.java.util.Set<MappedSuperclassTypeImpl<?>>getMappedSuperclasses()INTERNAL: Return the Set of MappedSuperclassType objectsorg.eclipse.persistence.sessions.ProjectgetProject()INTERNAL: Return the core API Project associated with the DatabaseSession that is associated with this Metamodelprotected org.eclipse.persistence.internal.sessions.AbstractSessiongetSession()INTERNAL: Return the DatabaseSession associated with this Metamodel<X> TypeImpl<X>getType(java.lang.Class<X> javaClass)INTERNAL: Return a Type representation of a java Class for use by the Metamodel Attributes.java.util.Map<java.lang.String,TypeImpl<?>>getTypes()INTERNAL: Return the Map of types on this metamodel.protected booleanhasMappedSuperclass(java.lang.String qualifiedClassNameKeyString)INTERNAL: Return whether there is a descriptor that is keyed by the supplied class name.voidinitialize(java.lang.ClassLoader classLoader)INTERNAL: Initialize the JPA metamodel that wraps the EclipseLink JPA metadata created descriptors.
Note: Since the types Map is lazy-loaded with key:value pairs - the designer and especially the user must realized that a particular BasicType may not be in the Map until it is referenced.booleanisInitialized()<X> javax.persistence.metamodel.ManagedType<X>managedType(java.lang.Class<X> clazz)Return the metamodel managed type representing the entity, mapped superclass, or embeddable class.voidprintAllTypes()INTERNAL: Print out all the Type attributes in the Metamodeljava.lang.StringtoString()INTERNAL: Return the string representation of the receiver.
-
-
-
Constructor Detail
-
MetamodelImpl
public MetamodelImpl(org.eclipse.persistence.internal.sessions.AbstractSession session)
-
MetamodelImpl
public MetamodelImpl(javax.persistence.EntityManager em)
-
MetamodelImpl
public MetamodelImpl(javax.persistence.EntityManagerFactory emf)
-
MetamodelImpl
public MetamodelImpl(EntityManagerSetupImpl emSetupImpl)
INTERNAL:- Parameters:
emSetupImpl-
-
-
Method Detail
-
embeddable
public <X> javax.persistence.metamodel.EmbeddableType<X> embeddable(java.lang.Class<X> clazz)
Return the metamodel embeddable type representing the embeddable class.- Specified by:
embeddablein interfacejavax.persistence.metamodel.Metamodel- Parameters:
clazz- the type of the represented embeddable class- Returns:
- the metamodel embeddable type
- Throws:
java.lang.IllegalArgumentException- if not an embeddable class
-
entity
public <X> javax.persistence.metamodel.EntityType<X> entity(java.lang.Class<X> clazz)
Return the metamodel entity type representing the entity.- Specified by:
entityin interfacejavax.persistence.metamodel.Metamodel- Parameters:
clazz- the type of the represented entity- Returns:
- the metamodel entity type
- Throws:
java.lang.IllegalArgumentException- if not an entity
-
getAllManagedTypeAttributes
public java.util.List<javax.persistence.metamodel.Attribute> getAllManagedTypeAttributes()
INTERNAL: Return a List of all attributes for all ManagedTypes.- Returns:
-
getEmbeddables
public java.util.Set<javax.persistence.metamodel.EmbeddableType<?>> getEmbeddables()
Return the metamodel embeddable types.- Specified by:
getEmbeddablesin interfacejavax.persistence.metamodel.Metamodel- Returns:
- the metamodel embeddable types
-
getEntities
public java.util.Set<javax.persistence.metamodel.EntityType<?>> getEntities()
Return the metamodel entity types.- Specified by:
getEntitiesin interfacejavax.persistence.metamodel.Metamodel- Returns:
- the metamodel entity types
-
getManagedTypesMap
public java.util.Map<java.lang.String,ManagedTypeImpl<?>> getManagedTypesMap()
Return the metamodel managed types map.
-
getManagedTypes
public java.util.Set<javax.persistence.metamodel.ManagedType<?>> getManagedTypes()
Return the metamodel managed types.- Specified by:
getManagedTypesin interfacejavax.persistence.metamodel.Metamodel- Returns:
- the metamodel managed types
-
getMappedSuperclasses
public java.util.Set<MappedSuperclassTypeImpl<?>> getMappedSuperclasses()
INTERNAL: Return the Set of MappedSuperclassType objects- Returns:
-
getProject
public org.eclipse.persistence.sessions.Project getProject()
INTERNAL: Return the core API Project associated with the DatabaseSession that is associated with this Metamodel- Returns:
-
getSession
protected org.eclipse.persistence.internal.sessions.AbstractSession getSession()
INTERNAL: Return the DatabaseSession associated with this Metamodel- Returns:
-
getType
public <X> TypeImpl<X> getType(java.lang.Class<X> javaClass)
INTERNAL: Return a Type representation of a java Class for use by the Metamodel Attributes.If a type does not yet exist - one will be created and added to the Metamodel - this usually only for Basic types.
This function will handle all Metamodel defined and core java classes.
- Parameters:
javaClass-- Returns:
-
getTypes
public java.util.Map<java.lang.String,TypeImpl<?>> getTypes()
INTERNAL: Return the Map of types on this metamodel. This includes all Entity, MappedSuperclass, Embeddable and Basic types- Returns:
-
hasMappedSuperclass
protected boolean hasMappedSuperclass(java.lang.String qualifiedClassNameKeyString)
INTERNAL: Return whether there is a descriptor that is keyed by the supplied class name.Referenced by ManagedTypeImpl.create()
- Parameters:
qualifiedClassNameKeyString-- Returns:
-
isInitialized
public boolean isInitialized()
-
initialize
public void initialize(java.lang.ClassLoader classLoader)
INTERNAL: Initialize the JPA metamodel that wraps the EclipseLink JPA metadata created descriptors.
Note: Since the types Map is lazy-loaded with key:value pairs - the designer and especially the user must realized that a particular BasicType may not be in the Map until it is referenced. Also note that a transient superclass (non-entity, non-mappedSuperclass) exists as a BasicType (it has no attributes), and that any inheriting Entity either directly subclassing or indirectly subclassing via a MappedSuperclass inheritance chain - does not pick up non-persistence fields that normally would be inherited. (The fields exist in Java but not in ORM:Metamodel) The transient class will have no JPA annotations. This is the second phase of metamodel initialization. It causes preindexed classes to have their attributes populated.
-
managedType
public <X> javax.persistence.metamodel.ManagedType<X> managedType(java.lang.Class<X> clazz)
Return the metamodel managed type representing the entity, mapped superclass, or embeddable class.- Specified by:
managedTypein interfacejavax.persistence.metamodel.Metamodel- Parameters:
clazz- the type of the represented managed class- Returns:
- the metamodel managed type
- Throws:
java.lang.IllegalArgumentException- if not a managed class
-
printAllTypes
public void printAllTypes()
INTERNAL: Print out all the Type attributes in the Metamodel
-
toString
public java.lang.String toString()
INTERNAL: Return the string representation of the receiver.- Overrides:
toStringin classjava.lang.Object
-
-