java.lang.Object
org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl
All Implemented Interfaces:
Metamodel, Serializable

public class MetamodelImpl extends Object implements Metamodel, Serializable

Purpose: 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:
  • Field Details

    • DEFAULT_ELEMENT_TYPE_FOR_UNSUPPORTED_MAPPINGS

      public static final Class<Object> DEFAULT_ELEMENT_TYPE_FOR_UNSUPPORTED_MAPPINGS
      Default elementType Class when we the type cannot be determined for unsupported mappings such as Transformation and VariableOneToOne
  • Constructor Details

  • Method Details

    • embeddable

      public <X> EmbeddableType<X> embeddable(Class<X> clazz)
      Return the metamodel embeddable type representing the embeddable class.
      Specified by:
      embeddable in interface Metamodel
      Parameters:
      clazz - the type of the represented embeddable class
      Returns:
      the metamodel embeddable type
      Throws:
      IllegalArgumentException - if not an embeddable class
    • entity

      public <X> EntityType<X> entity(Class<X> clazz)
      Return the metamodel entity type representing the entity.
      Specified by:
      entity in interface Metamodel
      Parameters:
      clazz - the type of the represented entity
      Returns:
      the metamodel entity type
      Throws:
      IllegalArgumentException - if not an entity
    • getAllManagedTypeAttributes

      public List<Attribute> getAllManagedTypeAttributes()
      INTERNAL: Return a List of all attributes for all ManagedTypes.
    • getEmbeddables

      public Set<EmbeddableType<?>> getEmbeddables()
      Return the metamodel embeddable types.
      Specified by:
      getEmbeddables in interface Metamodel
      Returns:
      the metamodel embeddable types
    • getEntities

      public Set<EntityType<?>> getEntities()
      Return the metamodel entity types.
      Specified by:
      getEntities in interface Metamodel
      Returns:
      the metamodel entity types
    • getManagedTypesMap

      public Map<String,ManagedTypeImpl<?>> getManagedTypesMap()
      Return the metamodel managed types map.
    • getManagedTypes

      public Set<ManagedType<?>> getManagedTypes()
      Return the metamodel managed types.
      Specified by:
      getManagedTypes in interface Metamodel
      Returns:
      the metamodel managed types
    • getMappedSuperclasses

      public Set<MappedSuperclassTypeImpl<?>> getMappedSuperclasses()
      INTERNAL: Return the Set of MappedSuperclassType objects
    • getProject

      public Project getProject()
      INTERNAL: Return the core API Project associated with the DatabaseSession that is associated with this Metamodel
    • getSession

      protected AbstractSession getSession()
      INTERNAL: Return the DatabaseSession associated with this Metamodel
    • getType

      public <X> TypeImpl<X> getType(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.

    • getTypes

      public Map<String,TypeImpl<?>> getTypes()
      INTERNAL: Return the Map of types on this metamodel. This includes all Entity, MappedSuperclass, Embeddable and Basic types
    • hasMappedSuperclass

      protected boolean hasMappedSuperclass(String qualifiedClassNameKeyString)
      INTERNAL: Return whether there is a descriptor that is keyed by the supplied class name.

      Referenced by ManagedTypeImpl.create()

    • isInitialized

      public boolean isInitialized()
    • initialize

      public void initialize(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> ManagedType<X> managedType(Class<X> clazz)
      Return the metamodel managed type representing the entity, mapped superclass, or embeddable class.
      Specified by:
      managedType in interface Metamodel
      Parameters:
      clazz - the type of the represented managed class
      Returns:
      the metamodel managed type
      Throws:
      IllegalArgumentException - if not a managed class
    • printAllTypes

      public void printAllTypes()
      INTERNAL: Print out all the Type attributes in the Metamodel
    • toString

      public String toString()
      INTERNAL: Return the string representation of the receiver.
      Overrides:
      toString in class Object