|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.mgmt.EntityImpl
public class EntityImpl
This class represents a default Entity implementation that can serve as a base class for Entity implementations. In addition this implementation optionally monitors changes on its properties.
| Field Summary | |
|---|---|
protected PropertyChangeSupport |
propertyChangeSupport
access to the embedded property change support; this variable is initally null (until initialized by enableChangeListenerSupport(boolean)) |
protected HashMap<String,Object> |
props
provides unmonitored access to the properties |
| Constructor Summary | |
|---|---|
|
EntityImpl(Object id)
|
|
EntityImpl(Object id,
Entity entity)
all properties from the given entity are copied into this entity; the given properties do NOT run through the property change check. |
protected |
EntityImpl(Object id,
Map<String,Object> properties)
the given properties do NOT run through the property change check; they ought to be checked once the extending class is fully initialized |
| Method Summary | |
|---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
|
protected void |
checkPropertyChange(String key,
Object value)
determines whether a property can be changed as given. |
protected boolean |
containsPropertyText(String text)
searches within the property values (based on toString()) for the given text case-insensivitely |
void |
enableChangeListenerSupport(boolean flag)
allows to enable/disable listener support on this object (disabled by default). |
boolean |
equals(Object obj)
returns true if the given Object is an Entity, is of the same class and its id is equal |
protected boolean |
equalWithProperties(Entity entity)
checks (next to equals) whether all properties are the same |
Object |
getID()
returns the immutable id that is used for checking equality |
Map<String,Object> |
getProperties()
generates a new view on each call |
Object |
getProperty(String key)
allows access to some property; may return null if not set |
PropertyChangeListener[] |
getPropertyChangeListeners()
|
int |
hashCode()
|
boolean |
isChangeListenerSupportEnabled()
determines whether listener support is enabled on this object (false by default) |
Object |
removeProperty(String key)
removes the given key from the properties |
void |
removePropertyChangeListener(PropertyChangeListener listener)
|
void |
setAll(Map<String,Object> map)
all imported properties are checked by checkPropertyChange() |
Object |
setProperty(String key,
Object value)
removes the given property |
protected void |
verifyProperties()
This default implementation simply runs all existing properties through checkPropertyChange(String, Object). |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected HashMap<String,Object> props
protected PropertyChangeSupport propertyChangeSupport
enableChangeListenerSupport(boolean)| Constructor Detail |
|---|
public EntityImpl(Object id)
public EntityImpl(Object id,
Entity entity)
checkPropertyChange()
checkPropertyChange(String, Object)
protected EntityImpl(Object id,
Map<String,Object> properties)
| Method Detail |
|---|
public Object getID()
getID in interface Resourcepublic int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Objectprotected boolean equalWithProperties(Entity entity)
public Object getProperty(String key)
Entity
getProperty in interface Entity
protected void verifyProperties()
throws IllegalArgumentException
checkPropertyChange(String, Object).
If any implementation requires to check for more (e.g. for missing properties),
this method is to be overridden to provide this functionality.
Within the implementation of EntityImpl, this method is never called.
IllegalArgumentException
protected void checkPropertyChange(String key,
Object value)
throws IllegalArgumentException
IllegalArgumentException - if the change of the value is not to be allowedsetProperty(String, Object),
removeProperty(String)
public Object setProperty(String key,
Object value)
throws IllegalArgumentException
Entity
setProperty in interface EntityIllegalArgumentException - if checkPropertyChange(key, value) throws one- See Also:
checkPropertyChange(String, Object)public void setAll(Map<String,Object> map)
checkPropertyChange()
public Object removeProperty(String key)
throws IllegalArgumentException
Entity
removeProperty in interface EntityIllegalArgumentException - if checkPropertyChange(key, value) throws one- See Also:
checkPropertyChange(String, Object)public Map<String,Object> getProperties()
getProperties in interface Entityprotected boolean containsPropertyText(String text)
public void enableChangeListenerSupport(boolean flag)
isChangeListenerSupportEnabled()public boolean isChangeListenerSupportEnabled()
enableChangeListenerSupport(boolean)
public void addPropertyChangeListener(PropertyChangeListener listener)
throws IllegalStateException
IllegalStateException - if the listener support is not enabled on this objectisChangeListenerSupportEnabled()
public void removePropertyChangeListener(PropertyChangeListener listener)
throws IllegalStateException
IllegalStateException - if the listener support is not enabled on this objectisChangeListenerSupportEnabled()
public PropertyChangeListener[] getPropertyChangeListeners()
throws IllegalStateException
IllegalStateException - if the listener support is not enabled on this objectisChangeListenerSupportEnabled()
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||