Class DynamicEntityState

java.lang.Object
io.jmix.dynmodel.impl.DynamicEntityState
All Implemented Interfaces:
EntityEntryExtraState, EntityValuesProvider, Serializable

public class DynamicEntityState extends Object implements EntityEntryExtraState, EntityValuesProvider
Entity extra state that provides dynamic attribute values, including calculated attribute evaluation.
See Also:
  • Field Details

    • entityEntry

      protected final EntityEntry entityEntry
    • dynamicPropertyNames

      protected Set<String> dynamicPropertyNames
    • dynamicValues

      protected DynamicValues dynamicValues
    • beanFactory

      protected transient org.springframework.beans.factory.BeanFactory beanFactory
  • Constructor Details

    • DynamicEntityState

      public DynamicEntityState(EntityEntry entityEntry, Set<String> dynamicPropertyNames, org.springframework.beans.factory.BeanFactory beanFactory)
      Creates dynamic entity state with calculated-attribute support.
      Parameters:
      entityEntry - entity entry
      dynamicPropertyNames - supported dynamic property names
      beanFactory - bean factory
    • DynamicEntityState

      public DynamicEntityState(EntityEntry entityEntry)
      Invoked by reflection in io.jmix.core.entity.BaseEntityEntry#copy(io.jmix.core.EntityEntry)
      Parameters:
      entityEntry - copied entity entry
  • Method Details

    • getDynamicValues

      public @Nullable DynamicValues getDynamicValues()
    • setDynamicValues

      public void setDynamicValues(DynamicValues dynamicValues)
      Sets loaded dynamic values for stored dynamic attributes.
      Parameters:
      dynamicValues - dynamic values
    • supportAttribute

      public boolean supportAttribute(String name)
      Returns whether this state provides a value for the given attribute.
      Specified by:
      supportAttribute in interface EntityValuesProvider
      Parameters:
      name - attribute name
      Returns:
      true if the attribute is dynamic and supported by this state
    • getAttributeValue

      public <T> @Nullable T getAttributeValue(String name)
      Returns a stored dynamic attribute value or evaluates a calculated dynamic attribute.
      Specified by:
      getAttributeValue in interface EntityValuesProvider
      Parameters:
      name - attribute name
      Returns:
      attribute value
    • setAttributeValue

      public void setAttributeValue(String name, @Nullable Object value, boolean checkEquals)
      Updates a stored dynamic attribute or rejects writes to calculated dynamic attributes.
      Specified by:
      setAttributeValue in interface EntityValuesProvider
      Parameters:
      name - attribute name
      value - new value
      checkEquals - whether equal values should suppress change events
    • getEntityEntry

      public EntityEntry getEntityEntry()
      Returns the entity entry that owns this state.
      Specified by:
      getEntityEntry in interface EntityEntryExtraState
      Returns:
      entity entry
    • copy

      public void copy(EntityEntryExtraState extraState)
      Copies supported property names, calculated support services, and stored dynamic values from another state.
      Specified by:
      copy in interface EntityEntryExtraState
      Parameters:
      extraState - source extra state
    • getAttributes

      public Set<String> getAttributes()
      Returns stored dynamic attribute names.
      Specified by:
      getAttributes in interface EntityValuesProvider
      Returns:
      stored dynamic attribute names
    • getChanges

      public Set<AttributeChanges.Change> getChanges()
      Returns changes collected for stored dynamic attributes.
      Specified by:
      getChanges in interface EntityValuesProvider
      Returns:
      dynamic attribute changes
    • putTransformed

      protected void putTransformed(Set<AttributeChanges.Change> output, Map<String,Object> source)
    • isCalculatedAttribute

      protected boolean isCalculatedAttribute(String name)
    • getMetaProperty

      protected MetaProperty getMetaProperty(String name)
    • getMetaPropertyMetaClass

      protected MetaClass getMetaPropertyMetaClass()
    • getMetadata

      protected Metadata getMetadata()
    • getCalculatedAttributeSupport

      protected DynamicCalculatedAttributeSupport getCalculatedAttributeSupport()
    • getDynamicModelTools

      protected DynamicModelTools getDynamicModelTools()