public class DynamicAttributesEntity extends java.lang.Object implements Entity
Instance.PropertyChangeEvent, Instance.PropertyChangeListener
Constructor and Description |
---|
DynamicAttributesEntity(BaseGenericIdEntity mainItem,
java.util.Collection<CategoryAttribute> attributes) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(ValueListener listener)
Add listener to track attributes changes.
|
void |
addPropertyChangeListener(Instance.PropertyChangeListener listener)
Add listener to track attributes changes.
|
java.util.UUID |
getId() |
java.lang.String |
getInstanceName() |
MetaClass |
getMetaClass() |
<T> T |
getValue(java.lang.String name)
Get an attribute value.
|
<T> T |
getValueEx(java.lang.String propertyPath)
Get an attribute value.
|
void |
removeAllListeners()
Remove all
Instance.PropertyChangeListener s. |
void |
removeListener(ValueListener listener)
Remove listener.
|
void |
removePropertyChangeListener(Instance.PropertyChangeListener listener)
Remove listener.
|
void |
setValue(java.lang.String name,
java.lang.Object value)
Set an attribute value.
|
void |
setValueEx(java.lang.String propertyPath,
java.lang.Object value)
Set an attribute value.
|
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 void addListener(ValueListener listener)
Instance
addListener
in interface Instance
listener
- listenerpublic void removeListener(ValueListener listener)
Instance
removeListener
in interface Instance
listener
- listener to removepublic 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. If the value returned from
getValueEx("car.driver")
is null or is not an Instance
, this method throws
IllegalStateException
.
Instance.PropertyChangeListener
s only if the attribute
was actually changed.setValueEx
in interface Instance
propertyPath
- path to an attributevalue
- attribute value