|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpl.edu.agh.cast.data.model.property.PropertyContainer
public class PropertyContainer
Default implementation of IPropertyContainer
. It should be either sub-classed or aggregated by other classes
that implement this interface.
Constructor Summary | |
---|---|
protected |
PropertyContainer()
Default constructor. |
|
PropertyContainer(MetaPropertyManager mpm)
Constructor. |
Method Summary | |
---|---|
void |
addProperty(Property<? extends MetaProperty> property)
Adds property to this container. |
protected void |
afterSetMetaPropertyManager()
Called right after setting the MPM. |
protected Property<? extends MetaProperty> |
createProperty(MetaProperty metaProperty)
|
void |
dispose()
Disposes this instance of PropertyContainer . |
Collection<CustomProperty> |
getCustomProperties()
Returns all custom properties. |
MetaPropertyManager |
getMetaPropertyManager()
Returns MetaPropertyManager of this container's properties. |
Collection<PermanentProperty> |
getPermanentProperties()
Returns all permanent properties. |
Collection<Property<? extends MetaProperty>> |
getProperties()
Returns all properties. |
Property<? extends MetaProperty> |
getProperty(String name)
Returns property with given name. |
Collection<TransientProperty> |
getTransientProperties()
Returns all transient properties. |
protected void |
initializeProperties()
|
boolean |
isValid()
Checks if the state of implementing object is valid. |
boolean |
matches(IPropertyContainer other)
Checks if this property container matches the property container argument. |
Property<? extends MetaProperty> |
removeProperty(String name)
Removes property with given name. |
void |
setMetaPropertyManager(MetaPropertyManager mpm)
Sets the MetaPropertyManager of this container's properties. |
Property<? extends MetaProperty> |
setProperty(String name,
Object value)
Modifies property value. |
void |
update(Observable sender,
Object event)
Notifies the container about change of the observed MetaPropertyManager (
getMetaPropertyManager() ). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected PropertyContainer()
Usage of this constructor is discouraged, since it does not provide any integrity control. If, however, this
constructor is used, the isValid()
method should be called in order to check the integrity.
public PropertyContainer(MetaPropertyManager mpm)
mpm
- MetaPropertyManager
which manages container's meta-propertiesMethod Detail |
---|
public void addProperty(Property<? extends MetaProperty> property)
addProperty
in interface IPropertyContainer
property
- property to add#addProperty(pl.edu.agh.cast.data.model.property.Property)
public Collection<CustomProperty> getCustomProperties()
getCustomProperties
in interface IPropertyContainer
IPropertyContainer.getCustomProperties()
public Collection<PermanentProperty> getPermanentProperties()
getPermanentProperties
in interface IPropertyContainer
IPropertyContainer.getPermanentProperties()
public Collection<TransientProperty> getTransientProperties()
getTransientProperties
in interface IPropertyContainer
IPropertyContainer.getTransientProperties()
public Collection<Property<? extends MetaProperty>> getProperties()
getProperties
in interface IPropertyContainer
IPropertyContainer.getProperties()
public Property<? extends MetaProperty> getProperty(String name)
If a property was not yet created but a meta-property with given name is defined in meta-property manager then a new instance is added to the container and returned.
getProperty
in interface IPropertyContainer
name
- name of the property
null
if property with given name is not definedIPropertyContainer.getProperty(java.lang.String)
public Property<? extends MetaProperty> removeProperty(String name)
removeProperty
in interface IPropertyContainer
name
- name of the property
IPropertyContainer.removeProperty(java.lang.String)
public Property<? extends MetaProperty> setProperty(String name, Object value)
setProperty
in interface IPropertyContainer
name
- name of the propertyvalue
- new value of the property
IPropertyContainer.setProperty(java.lang.String, java.lang.Object)
protected final void initializeProperties()
public MetaPropertyManager getMetaPropertyManager()
MetaPropertyManager
of this container's properties.
getMetaPropertyManager
in interface IPropertyContainer
IPropertyContainer.getMetaPropertyManager()
public final void setMetaPropertyManager(MetaPropertyManager mpm)
MetaPropertyManager
of this container's properties.
mpm
- the meta property managerprotected void afterSetMetaPropertyManager()
public final void update(Observable sender, Object event)
MetaPropertyManager
(
getMetaPropertyManager()
).
update
in interface Observer
sender
- the sender object - must be equal to this container's MetaPropertyManager
event
- the event object - must be an instance of MetaPropertyEvent
IllegalArgumentException
- if any of the arguments is null
or if
sender != this.getMetaPropertyManager()
or event
is not of type
MetaPropertyEvent
Observer.update(java.util.Observable, java.lang.Object)
public void dispose()
PropertyContainer
.
This method has to be called before disposing the container. Not doing so will result in the instance not being
garbage-collected (thus memory leakage).
dispose
in interface IDisposable
IDisposable.dispose()
public boolean matches(IPropertyContainer other)
One container matches the second one if:
true
). This means that all matchable meta properties from one container must exist in the second one
and also have to be matchable.
matches
in interface IPropertyContainer
other
- the reference property container with which to compare
matches(pl.edu.agh.cast.data.model.property.IPropertyContainer)
public boolean isValid()
isValid
in interface IValidatable
true
if object's state is valid, false
otherwiseIValidatable.isValid()
protected Property<? extends MetaProperty> createProperty(MetaProperty metaProperty)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |