Class MetamodelImpl

java.lang.Object
org.apache.openjpa.persistence.meta.MetamodelImpl
All Implemented Interfaces:
jakarta.persistence.metamodel.Metamodel, Resolver

public class MetamodelImpl extends Object implements jakarta.persistence.metamodel.Metamodel, Resolver
Adapts JPA Metamodel to OpenJPA meta-data repository.
Author:
Pinaki Poddar
  • Constructor Details

    • MetamodelImpl

      public MetamodelImpl(MetaDataRepository repos)
      Constructs a model with the current content of the supplied non-null repository.
  • Method Details

    • getRepository

      public MetaDataRepository getRepository()
    • embeddable

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

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

      public <X> jakarta.persistence.metamodel.EntityType<X> entityImpl(Class<X> clazz)
    • getEmbeddables

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

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

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

      public <X> jakarta.persistence.metamodel.ManagedType<X> managedType(Class<X> clazz)
      Return the metamodel managed type representing the entity, mapped superclass, or embeddable class.
      Specified by:
      managedType in interface jakarta.persistence.metamodel.Metamodel
      Parameters:
      cls - the type of the represented managed class
      Returns:
      the metamodel managed type
      Throws:
      IllegalArgumentException - if not a managed class
    • getType

      public <X> jakarta.persistence.metamodel.Type<X> getType(Class<X> cls)
      Return the type representing the basic, entity, mapped superclass, or embeddable class. This method differs from #type(Class) as it also creates a basic or pesudo type for the given class argument if not already available in this receiver.
      Parameters:
      cls - the type of the represented managed class
      Returns:
      the metamodel managed type
      Throws:
      IllegalArgumentException - if not a managed class
    • getPersistenceType

      public static jakarta.persistence.metamodel.Type.PersistenceType getPersistenceType(ClassMetaData meta)
    • unmodifiableSet

      public <T> Set<T> unmodifiableSet(Collection<T> coll)
    • populate

      public <X> void populate(AbstractManagedType<X> type)
      Populate the static fields of the canonical type.
    • classForName

      public Class classForName(String name, String[] imports)
      Description copied from interface: Resolver
      Resolve the type represented by the given class name. This will test the type against the namespace of the Query and the declared imports, and will properly handle primitives and java.lang types as well. Returns null if the name does not match a known type.
      Specified by:
      classForName in interface Resolver
    • getAggregateListener

      public AggregateListener getAggregateListener(String tag)
      Description copied from interface: Resolver
      Return the function listener for the given tag, or null if none.
      Specified by:
      getAggregateListener in interface Resolver
    • getConfiguration

      public OpenJPAConfiguration getConfiguration()
      Description copied from interface: Resolver
      Return the OpenJPA configuration.
      Specified by:
      getConfiguration in interface Resolver
    • getFilterListener

      public FilterListener getFilterListener(String tag)
      Description copied from interface: Resolver
      Return the filter listener for the given tag, or null if none.
      Specified by:
      getFilterListener in interface Resolver
    • getQueryContext

      public QueryContext getQueryContext()
      Description copied from interface: Resolver
      The QueryContext for which this resolver was created
      Specified by:
      getQueryContext in interface Resolver