Class AspectParameter<T extends ComplexEntity>

java.lang.Object
mc.core.system.base.BaseBean
mc.core.domain.base.dobj.AbstractAspect<T>
mc.core.domain.base.aspect.AspectParameter<T>

public class AspectParameter<T extends ComplexEntity> extends AbstractAspect<T>
for EntityParameter and EntityData (as a special case of EntityParameter
  • Constructor Details

    • AspectParameter

      public AspectParameter()
  • Method Details

    • getValue

      public String getValue(T entity, Object key)
      Parameters:
      entity - mandatory
      key - mandatory, not null
      Returns:
      entity value as String, can be null if value for this key not exist
    • getValue

      public <V> V getValue(T entity, Object key, Class<V> type)
      Parameters:
      entity - mandatory
      key - mandatory, not null
      type - mandatory, target type for value. uses conversion rules fro ObjectConvert
      Returns:
      entity value in given type, can be null if value for this key not exist or value cannot be converted to target type
    • set

      public void set(T entity, Object key, Object value)
      insert (if not exist with this key) or edit the value of entity parameter. If value is null or empty string removes entity parameter if exists
      Parameters:
      entity - mandatory
      key - mandatory, not null
      value - optional
    • remove

      public void remove(T entity, Object key)
      removes entity parameter if exists
      Parameters:
      entity - mandatory
      key - mandatory
    • setData

      public void setData(T entity, Object key, Object data)
    • setData

      public void setData(T entity, Object key, String fileId, String filename)
    • hasData

      public boolean hasData(T entity, Object key)
      checks if data corresponding to given key exists for given entity
      Parameters:
      entity - mandatory
      key - mandatory
      Returns:
      true if data corresponding to key exists, false otherwise
    • getData

      public String getData(T entity, Object key)
      returns data corresponding to given key for given entity
      Parameters:
      entity - mandatory
      key - mandatory
      Returns:
      String containing data if found, null otherwise
    • removeData

      public void removeData(T entity, Object key)
      removes entity data if exists
      Parameters:
      entity - mandatory
      key - mandatory
    • set

      public void set(T entity, Object key, Object value, boolean asDataIfTooLarge)
      set value as entity parameter, or entity data if value.toString() exceeds max param length and asDataIfTooLarge is set to true
      Parameters:
      entity - mandatory
      key - mandatory
      value - optional, remove param/data if null
      asDataIfTooLarge - optional
    • get

      public <V> V get(T entity, Object key, Class<V> valueType)
      get value transparently from entity parameter or entity data
      Parameters:
      entity - mandatory
      key - mandatory
      valueType - mandatory
      Returns:
      entity value in given type, can be null if value for this key not exist or value cannot be converted to target type
    • setMap

      public void setMap(T entity, DataMap dataMap)
      set parameter/data value from map
      Parameters:
      entity - mandatory
      dataMap - mandatory
    • getMap

      public DataMap getMap(T entity)
      get all parameter/data values as map
      Parameters:
      entity - mandatory
      Returns:
      dataMap with param/data as key/values. never null