Class MetadataImpl

java.lang.Object
io.jmix.core.impl.MetadataImpl
All Implemented Interfaces:
Metadata, Session

@Component("core_Metadata") public class MetadataImpl extends Object implements Metadata
  • Field Details

    • session

      protected volatile Session session
    • resources

      @Autowired protected Resources resources
    • entityInitializers

      @Lazy @Autowired(required=false) protected List<EntityInitializer> entityInitializers
    • metadataGenerationManagerProvider

      @Autowired protected org.springframework.beans.factory.ObjectProvider<MetadataGenerationManager> metadataGenerationManagerProvider
  • Constructor Details

    • MetadataImpl

      @Autowired public MetadataImpl(MetadataLoader metadataLoader)
  • Method Details

    • getSession

      public Session getSession()
      Description copied from interface: Metadata
      Get Metadata session - interface providing access to MetaClasses and MetaProperties.
      Specified by:
      getSession in interface Metadata
      Returns:
      current metadata session
    • getRawSession

      public Session getRawSession()
      Returns the raw metadata session without applying generation pinning.

      Intended for bootstrap and publication code that manages generation snapshots itself.

    • setRawSession

      public void setRawSession(Session session)
      Replaces the raw metadata session exposed as the latest published snapshot.
      Parameters:
      session - metadata session to publish as the raw current snapshot
    • getClass

      public MetaClass getClass(Object entity)
      Description copied from interface: Metadata
      Returns MetaClass of the given entity.
      Specified by:
      getClass in interface Metadata
      Parameters:
      entity - entity instance
      Returns:
      MetaClass instance
    • internalCreate

      protected <T> T internalCreate(Class<T> entityClass)
    • internalCreate

      protected <T> T internalCreate(Class<T> entityClass, @Nullable Object id)
    • internalCreate

      protected <T> T internalCreate(Class<T> entityClass, @Nullable Object id, Predicate<EntityInitializer> initializerFilter)
    • create

      public <T> T create(Class<T> entityClass)
      Description copied from interface: Metadata
      Instantiate an entity, taking into account extended entities.
      Specified by:
      create in interface Metadata
      Parameters:
      entityClass - entity class
      Returns:
      entity instance
    • create

      public <T> T create(Class<T> entityClass, Object id)
      Description copied from interface: Metadata
      Instantiate an entity with provided id, taking into account extended entities.
      Specified by:
      create in interface Metadata
      Parameters:
      entityClass - entity class
      id - entity id
      Returns:
      entity instance
    • create

      public Object create(MetaClass metaClass)
      Description copied from interface: Metadata
      Instantiate an entity, taking into account extended entities.
      Specified by:
      create in interface Metadata
      Parameters:
      metaClass - entity MetaClass
      Returns:
      entity instance
    • create

      public Object create(MetaClass metaClass, Object id)
      Description copied from interface: Metadata
      Instantiate an entity with provided id, taking into account extended entities.
      Specified by:
      create in interface Metadata
      Parameters:
      metaClass - entity MetaClass
      id - entity id
      Returns:
      entity instance
    • create

      public Object create(String entityName)
      Description copied from interface: Metadata
      Instantiate an entity, taking into account extended entities.
      Specified by:
      create in interface Metadata
      Parameters:
      entityName - entity name
      Returns:
      entity instance
    • create

      public Object create(String entityName, Object id)
      Description copied from interface: Metadata
      Instantiate an entity with provided id, taking into account extended entities.
      Specified by:
      create in interface Metadata
      Parameters:
      entityName - entity name
      id - entity id
      Returns:
      entity instance
    • createForExistingEntity

      public Object createForExistingEntity(MetaClass metaClass)
      Description copied from interface: Metadata
      Instantiate an entity that already exists, for example when the entity is deserialized from JSON.

      Unlike Metadata.create(MetaClass), invokes only the EntityInitializer beans that are applicable to existing entities.

      Specified by:
      createForExistingEntity in interface Metadata
      Parameters:
      metaClass - entity MetaClass
      Returns:
      entity instance
    • findClass

      public @Nullable MetaClass findClass(String name)
      Description copied from interface: Session
      Search MetaClass by its name in the whole metamodel.
      Specified by:
      findClass in interface Session
      Parameters:
      name - entity name
      Returns:
      MetaClass instance or null if not found
    • getClass

      public MetaClass getClass(String name)
      Description copied from interface: Session
      Search MetaClass by its name in the whole metamodel.
      Specified by:
      getClass in interface Session
      Parameters:
      name - entity name
      Returns:
      MetaClass instance. Throws exception if not found.
    • findClass

      public @Nullable MetaClass findClass(Class<?> javaClass)
      Description copied from interface: Session
      Search MetaClass by the corresponding Java class in the whole metamodel.
      Specified by:
      findClass in interface Session
      Parameters:
      javaClass - Java class defining the entity
      Returns:
      MetaClass instance or null if not found
    • getClass

      public MetaClass getClass(Class<?> javaClass)
      Description copied from interface: Session
      Search MetaClass by the corresponding Java class in the whole metamodel.
      Specified by:
      getClass in interface Session
      Parameters:
      javaClass - Java class defining the entity
      Returns:
      MetaClass instance. Throws exception if not found.
    • getClasses

      public Collection<MetaClass> getClasses()
      Specified by:
      getClasses in interface Session
      Returns:
      collection of all MetaClasses in the whole metamodel