|
||||||||||
| 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
pl.edu.agh.cast.data.model.AbstractElement
public abstract class AbstractElement
Abstract implementation of IElement.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface pl.edu.agh.cast.data.model.Identifiable |
|---|
Identifiable.Properties |
| Field Summary |
|---|
| Fields inherited from interface pl.edu.agh.cast.data.model.IElement |
|---|
TYPE |
| Constructor Summary | |
|---|---|
protected |
AbstractElement(Type type)
Initializes element with type. |
protected |
AbstractElement(Type type,
UUID id)
Initializes element with type and ID. |
protected |
AbstractElement(Type type,
UUID id,
IDataSet<? extends IElement> dataSet)
Initializes element with ID and type. |
| Method Summary | |
|---|---|
protected void |
afterSetMetaPropertyManager()
Adds all PermanentProperty'ies and TransientProperty'ies defined this container's meta-property
manager. |
protected void |
canReplicateTo(Object replica,
Class<?> clazz)
|
protected boolean |
checkIfValid()
Checks if the element is valid. |
boolean |
equals(Object other)
Compares two elements. |
IDataSet<? extends IElement> |
getDataSet()
Returns the data set this element is in. |
protected String |
getDescString()
Returns a string with short description of element. |
UUID |
getId()
Returns object's globally unique ID. |
Type |
getType()
Returns object's type. |
int |
hashCode()
Returns the hash code of the element. |
boolean |
isValid()
Checks if the state of implementing object is valid. |
AbstractElement |
replicate()
Returns a replicated instance of this instance. |
AbstractElement |
replicateTo(Object replica)
Replicates this instance state to given replica object. |
void |
setDataSet(IDataSet<? extends IElement> dataSet)
Sets the data set of the element. |
void |
setId(UUID id)
Sets the ID of the element. |
void |
setType(Type type)
Sets the type of the element. |
String |
toString()
|
| Methods inherited from class pl.edu.agh.cast.data.model.property.PropertyContainer |
|---|
addProperty, createProperty, dispose, getCustomProperties, getMetaPropertyManager, getPermanentProperties, getProperties, getProperty, getTransientProperties, initializeProperties, matches, removeProperty, setMetaPropertyManager, setProperty, update |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface pl.edu.agh.cast.data.model.property.IPropertyContainer |
|---|
addProperty, getCustomProperties, getMetaPropertyManager, getPermanentProperties, getProperties, getProperty, getTransientProperties, matches, removeProperty, setProperty |
| Methods inherited from interface java.util.Observer |
|---|
update |
| Methods inherited from interface pl.edu.agh.cast.common.IDisposable |
|---|
dispose |
| Constructor Detail |
|---|
protected AbstractElement(Type type)
type - type of the element
IllegalArgumentException - if the argument is null
protected AbstractElement(Type type,
UUID id)
type - type of the elementid - ID of the element
IllegalArgumentException - if any of the arguments is null
protected AbstractElement(Type type,
UUID id,
IDataSet<? extends IElement> dataSet)
type - type of the elementid - ID of the elementdataSet - the IDataSet this element is in
IllegalArgumentException - if any of the arguments is null or dataSet.getMetaPropertyManager(type)
returns null| Method Detail |
|---|
public final boolean isValid()
isValid in interface IValidatableisValid in class PropertyContainertrue if object's state is valid, false otherwisepl.edu.agh.cast.data.model.AbstractInitializable#doInitialize()protected boolean checkIfValid()
This method is called by the isValid() method. By default it always returns true, however
it can be overridden in order to define new validation rules. In such case the implementation from base class
should be called inside the overridden method in order to preserve data consistency.
true if the element is valid, false otherwisepublic final UUID getId()
getId in interface IdentifiableIdentifiable.getId()public final void setId(UUID id)
id - the element ID
ModelException - if the ID is already set and it is not equal to given one
IllegalArgumentException - if the given ID is nullpublic final Type getType()
getType in interface IdentifiableIdentifiable.getType()public final void setType(Type type)
type - the element type
ModelException - if the type is already set
IllegalArgumentException - if the given type is null or is not a type of elementpublic final IDataSet<? extends IElement> getDataSet()
getDataSet in interface IElementIElement.getDataSet()public final void setDataSet(IDataSet<? extends IElement> dataSet)
This method cannot be called before the type and ID are defined.
dataSet - the element's data set
ModelException - if the data set is already set or element is not ready for it (the type or ID is not defined)
IllegalArgumentException - if the given data set is nullsetType(Type),
setId(UUID)protected final void afterSetMetaPropertyManager()
PermanentProperty'ies and TransientProperty'ies defined this container's meta-property
manager.
Called right after setting the MPM. May be overridden.
afterSetMetaPropertyManager in class PropertyContainerPropertyContainer.afterSetMetaPropertyManager()public final boolean equals(Object other)
IPropertyContainer#match(IPropertyContainer) method.
equals in class ObjectObject.equals(java.lang.Object),
IPropertyContainer#match(IPropertyContainer)public final int hashCode()
This method will throw NullPointerException if the ID is not set.
hashCode in class ObjectgetId(),
Object.hashCode()public final String toString()
toString in class ObjectObject.toString()protected String getDescString()
toString() and may be
overridden in order to customize its results.
protected final void canReplicateTo(Object replica,
Class<?> clazz)
public AbstractElement replicateTo(Object replica)
throws IllegalArgumentException,
ReplicationException
Replicates element type and ID.
replicateTo in interface IReplicablereplica - the object to replicate to
IllegalArgumentException - if given object is null or of invalid type
ReplicationException - if replication failsIReplicable.replicateTo(java.lang.Object)
public AbstractElement replicate()
throws ReplicationException
replicate in interface IReplicableReplicationException - if replication failsIReplicable.replicate()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||