Class EntityValues

java.lang.Object
io.jmix.core.entity.EntityValues

public class EntityValues extends Object
  • Constructor Details

    • EntityValues

      public EntityValues()
  • Method Details

    • isEntity

      public static boolean isEntity(Object entity)
    • getId

      @Nullable public static Object getId(Object entity)
    • setId

      public static void setId(Object entity, Object key)
    • getIdOrEntity

      public static Object getIdOrEntity(Object entity)
    • getGeneratedId

      public static Object getGeneratedId(Object entity)
    • setGeneratedId

      public static void setGeneratedId(Object entity, Object id)
    • setValue

      public static void setValue(Object entity, String name, Object value)
      Set an attribute value.
      An implementor should first read a current value of the attribute, and then call an appropriate setter method only if the new value differs. This ensures triggering of EntityPropertyChangeListeners only if the attribute was actually changed.
      Parameters:
      name - attribute name according to JavaBeans notation
      value - attribute value
    • setValue

      public static void setValue(Object entity, String name, Object value, boolean checkEquals)
      Set an attribute value.
      An implementor should first read a current value of the attribute, and then call an appropriate setter method only if the new value differs. This ensures triggering of EntityPropertyChangeListeners only if the attribute was actually changed.
      Parameters:
      name - attribute name according to JavaBeans notation
      value - attribute value
      checkEquals - check equals for previous and new value. If flag is true and objects equals, then setter will not be invoked
    • getValue

      @Nullable public static <T> T getValue(Object entity, String name)
      Get an attribute value.
      Parameters:
      name - attribute name according to JavaBeans notation
      Returns:
      attribute value
    • getValueEx

      @Nullable public static <T> T getValueEx(Object entity, String propertyPath)
      Get an attribute value. Locates the attribute by the given path in object graph starting from this instance.
      The path must consist of attribute names according to JavaBeans notation, separated by dots, e.g. car.driver.name.
      Parameters:
      propertyPath - path to an attribute
      Returns:
      attribute value. If any traversing attribute value is null or is not an Entity, this method stops here and returns this value.
    • getValueEx

      @Nullable public static <T> T getValueEx(Object entity, PropertyPath propertyPath)
      Get an attribute value. Locates the attribute by the given path in object graph starting from this instance.
      The path must consist of attribute names according to JavaBeans notation, separated by dots, e.g. car.driver.name.
      Parameters:
      propertyPath - path to an attribute
      Returns:
      attribute value. If any traversing attribute value is null or is not an Entity, this method stops here and returns this value.
    • setValueEx

      public static void setValueEx(Object entity, String propertyPath, Object value)
      Set an attribute value. Locates the attribute by the given path in object graph starting from this instance.
      The path must consist of attribute names according to JavaBeans notation, separated by dots, e.g. car.driver.name.
      In the example above this method first gets value of car.driver attribute, and if it is not null and is an Entity, sets value of name attribute in it.
      An implementor should first read a current value of the attribute, and then call an appropriate setter method only if the new value differs. This ensures triggering of EntityPropertyChangeListeners only if the attribute was actually changed.
      Parameters:
      propertyPath - path to an attribute
      value - attribute value
    • setValueEx

      public static void setValueEx(Object entity, PropertyPath propertyPath, Object value)
      Set an attribute value. Locates the attribute by the given path in object graph starting from this instance.
      The path must consist of attribute names according to JavaBeans notation, separated by dots, e.g. car.driver.name.
      In the example above this method first gets value of car.driver attribute, and if it is not null and is an Entity, sets value of name attribute in it.
      An implementor should first read a current value of the attribute, and then call an appropriate setter method only if the new value differs. This ensures triggering of EntityPropertyChangeListeners only if the attribute was actually changed.
      Parameters:
      propertyPath - path to an attribute
      value - attribute value
    • setValueEx

      public static void setValueEx(Object entity, String[] properties, Object value)
      Set value of an attribute according to the rules described in setValueEx(Object, String, Object).
      Parameters:
      entity - instance
      properties - path to the attribute
      value - attribute value
    • getValueEx

      public static <T> T getValueEx(Object entity, String[] properties)
      Get value of an attribute according to the rules described in getValueEx(Object, String).
      Parameters:
      entity - entity
      properties - path to the attribute
      Returns:
      attribute value
    • propertyValueEquals

      public static boolean propertyValueEquals(@Nullable Object a, @Nullable Object b)
      Used by to check whether a property value has been changed.
      Parameters:
      a - an object
      b - an object
      Returns:
      true if a equals to b, but in case of a is or Collection returns true only if a is the same instance as b
    • isUuidSupported

      public static boolean isUuidSupported(Object entity)
    • getUuid

      @Nullable public static UUID getUuid(Object entity)
    • setUuid

      public static void setUuid(Object entity, UUID uuid)
    • isVersionSupported

      public static boolean isVersionSupported(Object entity)
    • getVersion

      @Nullable public static Object getVersion(Object entity)
    • setVersion

      public static void setVersion(Object entity, Object version)
    • isSoftDeletionSupported

      public static boolean isSoftDeletionSupported(Object entity)
    • isSoftDeleted

      public static boolean isSoftDeleted(Object entity)
    • getDeletedDate

      public static Object getDeletedDate(Object entity)
    • setDeletedDate

      public static void setDeletedDate(Object entity, Object value)
    • getDeletedBy

      public static Object getDeletedBy(Object entity)
    • setDeletedBy

      public static void setDeletedBy(Object entity, Object value)
    • isAuditSupported

      public static boolean isAuditSupported(Object entity)
    • getCreatedDate

      public static Object getCreatedDate(Object entity)
    • setCreatedDate

      public static void setCreatedDate(Object entity, Object value)
    • getCreatedBy

      public static Object getCreatedBy(Object entity)
    • setCreatedBy

      public static void setCreatedBy(Object entity, Object value)
    • getLastModifiedDate

      public static Object getLastModifiedDate(Object entity)
    • setLastModifiedDate

      public static void setLastModifiedDate(Object entity, Object value)
    • getLastModifiedBy

      public static Object getLastModifiedBy(Object entity)
    • setLastModifiedBy

      public static void setLastModifiedBy(Object entity, Object value)