public abstract class AbstractInstance extends java.lang.Object implements Instance
Instance.PropertyChangeEvent, Instance.PropertyChangeListener
Constructor and Description |
---|
AbstractInstance() |
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.lang.String |
getInstanceName() |
<T> T |
getValue(java.lang.String name)
Get an attribute value.
|
<T> T |
getValueEx(java.lang.String name)
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 |
setValue(java.lang.String name,
java.lang.Object value,
boolean checkEquals)
Set value to property in instance
For internal use only.
|
void |
setValueEx(java.lang.String name,
java.lang.Object value)
Set an attribute value.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMetaClass
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 void setValue(java.lang.String name, java.lang.Object value, boolean checkEquals)
setValue(String, Object)
name
- property namevalue
- valuecheckEquals
- check equals for previous and new value.
If flag is true and objects equals, then setter will not be invokedpublic <T> T getValueEx(java.lang.String name)
Instance
car.driver.name
.getValueEx
in interface Instance
name
- path to an attributeInstance
, this method
stops here and returns this value.public void setValueEx(java.lang.String name, 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
name
- path to an attributevalue
- attribute value