public class DynamicAttributesEntity extends java.lang.Object implements Entity
Instance.BeanPropertyPath, Instance.PropertyChangeEvent, Instance.PropertyChangeListener
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,CategoryAttribute> |
attributesMap |
protected java.util.UUID |
id |
protected BaseGenericIdEntity |
mainItem |
Constructor and Description |
---|
DynamicAttributesEntity(BaseGenericIdEntity mainItem,
java.util.Collection<CategoryAttribute> attributes) |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(Instance.PropertyChangeListener listener)
Add listener to track attributes changes.
|
java.util.UUID |
getId() |
java.lang.String |
getInstanceName() |
BaseGenericIdEntity |
getMainItem() |
MetaClass |
getMetaClass() |
<T> T |
getValue(java.lang.String name)
Get an attribute value.
|
<T> T |
getValueEx(Instance.BeanPropertyPath propertyPath)
Get an attribute value.
|
<T> T |
getValueEx(java.lang.String propertyPath)
Get an attribute value.
|
void |
removeAllListeners()
Remove all
Instance.PropertyChangeListener s. |
void |
removePropertyChangeListener(Instance.PropertyChangeListener listener)
Remove listener.
|
void |
setValue(java.lang.String name,
java.lang.Object value)
Set an attribute value.
|
void |
setValueEx(Instance.BeanPropertyPath propertyPath,
java.lang.Object value)
Set an attribute value.
|
void |
setValueEx(java.lang.String propertyPath,
java.lang.Object value)
Set an attribute value.
|
protected BaseGenericIdEntity mainItem
protected java.util.UUID id
protected java.util.Map<java.lang.String,CategoryAttribute> attributesMap
public DynamicAttributesEntity(BaseGenericIdEntity mainItem, java.util.Collection<CategoryAttribute> attributes)
public MetaClass getMetaClass()
getMetaClass
in interface Instance
public java.lang.String getInstanceName()
getInstanceName
in interface Instance
NamePattern
or toString()
.public BaseGenericIdEntity getMainItem()
public void addPropertyChangeListener(Instance.PropertyChangeListener listener)
Instance
addPropertyChangeListener
in interface Instance
listener
- listenerpublic void removePropertyChangeListener(Instance.PropertyChangeListener listener)
Instance
removePropertyChangeListener
in interface Instance
listener
- listener to removepublic void removeAllListeners()
Instance
Instance.PropertyChangeListener
s.removeAllListeners
in interface Instance
public <T> T getValue(java.lang.String name)
Instance
public void setValue(java.lang.String name, java.lang.Object value)
Instance
Instance.PropertyChangeListener
s only if the attribute
was actually changed.public <T> T getValueEx(java.lang.String propertyPath)
Instance
car.driver.name
.getValueEx
in interface Instance
propertyPath
- path to an attributeInstance
, this method
stops here and returns this value.public void setValueEx(java.lang.String propertyPath, java.lang.Object value)
Instance
car.driver.name
.
car.driver
attribute, and if it is not
null and is an Instance
, sets value of name
attribute in it.
Instance.PropertyChangeListener
s only if the attribute
was actually changed.setValueEx
in interface Instance
propertyPath
- path to an attributevalue
- attribute value@Nullable public <T> T getValueEx(Instance.BeanPropertyPath propertyPath)
Instance
car.driver.name
.getValueEx
in interface Instance
propertyPath
- path to an attributeInstance
, this method
stops here and returns this value.public void setValueEx(Instance.BeanPropertyPath propertyPath, java.lang.Object value)
Instance
car.driver.name
.
car.driver
attribute, and if it is not
null and is an Instance
, sets value of name
attribute in it.
Instance.PropertyChangeListener
s only if the attribute
was actually changed.setValueEx
in interface Instance
propertyPath
- path to an attributevalue
- attribute value