Package org.arakhne.afc.attrs.collection
Class AbstractAttributeCollection
- java.lang.Object
-
- org.arakhne.afc.attrs.collection.AbstractAttributeProvider
-
- org.arakhne.afc.attrs.collection.AbstractAttributeCollection
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<Attribute>
,AttributeCollection
,AttributeProvider
,JsonableObject
- Direct Known Subclasses:
BufferedAttributeCollection
,HeapAttributeCollection
public abstract class AbstractAttributeCollection extends AbstractAttributeProvider implements AttributeCollection
This class implements an abstract object with attributes.- Version:
- 17.0 2020-01-04 14:41:51
- Author:
- Stéphane GALLAND
- See Also:
- Serialized Form
- Maven Group Id:
- org.arakhne.afc.advanced
- Maven Artifact Id:
- attributes
-
-
Constructor Summary
Constructors Constructor Description AbstractAttributeCollection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttributeChangeListener(AttributeChangeListener listener)
Add a listener on the attribute value changes.AttributeCollection
clone()
Make a deep copy of this object and replies the copy.protected void
fireAttributeAddedEvent(String name, AttributeValue attr)
Fire the addition event.protected void
fireAttributeChangedEvent(String name, AttributeValue oldValue, AttributeValue currentValue)
Fire the attribute change event.protected void
fireAttributeClearedEvent()
Fire the all attribute removal event.protected void
fireAttributeRemovedEvent(String name, AttributeValue oldValue)
Fire the an attribute removal event.protected void
fireAttributeRenamedEvent(String oldName, String newName, AttributeValue attr)
Fire the renaming event.boolean
isEventFirable()
Replies if the events are fired by this container.void
removeAttributeChangeListener(AttributeChangeListener listener)
Remove a listener on the attribute value changes.boolean
renameAttribute(String oldname, String newname)
Rename the attribute.void
setEventFirable(boolean isFirable)
Set if the events are fired by this container.-
Methods inherited from class org.arakhne.afc.attrs.collection.AbstractAttributeProvider
attributes, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttributeAsBool, getAttributeAsDate, getAttributeAsDouble, getAttributeAsEnumeration, getAttributeAsEnumeration, getAttributeAsFloat, getAttributeAsInetAddress, getAttributeAsInt, getAttributeAsJavaClass, getAttributeAsLong, getAttributeAsString, getAttributeAsURI, getAttributeAsURL, getAttributeAsUUID, iterator, protectNull, toJson, toString, unprotectNull
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.arakhne.afc.attrs.collection.AttributeCollection
addAttributes, addAttributes, flush, removeAllAttributes, removeAttribute, renameAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributes, setAttributes, setAttributeType
-
Methods inherited from interface org.arakhne.afc.attrs.collection.AttributeProvider
attributes, freeMemory, getAllAttributeNames, getAllAttributes, getAllAttributesByType, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttributeAsBool, getAttributeAsDate, getAttributeAsDouble, getAttributeAsEnumeration, getAttributeAsEnumeration, getAttributeAsFloat, getAttributeAsInetAddress, getAttributeAsInt, getAttributeAsJavaClass, getAttributeAsLong, getAttributeAsString, getAttributeAsURI, getAttributeAsURL, getAttributeAsUUID, getAttributeCount, getAttributeObject, hasAttribute, toMap, toMap
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface org.arakhne.afc.vmutil.json.JsonableObject
toJson
-
-
-
-
Method Detail
-
isEventFirable
@Pure public boolean isEventFirable()
Description copied from interface:AttributeCollection
Replies if the events are fired by this container.- Specified by:
isEventFirable
in interfaceAttributeCollection
- Returns:
true
if the events are fired; otherwisefalse
if events are not fired.
-
setEventFirable
public void setEventFirable(boolean isFirable)
Description copied from interface:AttributeCollection
Set if the events are fired by this container.- Specified by:
setEventFirable
in interfaceAttributeCollection
- Parameters:
isFirable
- istrue
if the events are fired; otherwisefalse
if events are not fired.
-
clone
@Pure public AttributeCollection clone()
Make a deep copy of this object and replies the copy.- Specified by:
clone
in interfaceAttributeCollection
- Specified by:
clone
in interfaceAttributeProvider
- Overrides:
clone
in classAbstractAttributeProvider
- Returns:
- the deep copy.
-
fireAttributeAddedEvent
protected void fireAttributeAddedEvent(String name, AttributeValue attr)
Fire the addition event.- Parameters:
name
- is the name of the attribute for which the event occured.attr
- is the value of the attribute.
-
fireAttributeChangedEvent
protected void fireAttributeChangedEvent(String name, AttributeValue oldValue, AttributeValue currentValue)
Fire the attribute change event.- Parameters:
name
- is the name of the attribute for which the event occured.oldValue
- is the previous value of the attributecurrentValue
- is the current value of the attribute
-
fireAttributeClearedEvent
protected void fireAttributeClearedEvent()
Fire the all attribute removal event.
-
fireAttributeRemovedEvent
protected void fireAttributeRemovedEvent(String name, AttributeValue oldValue)
Fire the an attribute removal event.- Parameters:
name
- is the name of the attribute for which the event occured.oldValue
- is the previous value of the attribute
-
fireAttributeRenamedEvent
protected void fireAttributeRenamedEvent(String oldName, String newName, AttributeValue attr)
Fire the renaming event.- Parameters:
oldName
- is the previous name of the attribute (before renaming)newName
- is the new name of the attribute (after renaming)attr
- is the value of the attribute.
-
addAttributeChangeListener
public void addAttributeChangeListener(AttributeChangeListener listener)
Description copied from interface:AttributeCollection
Add a listener on the attribute value changes.- Specified by:
addAttributeChangeListener
in interfaceAttributeCollection
- Parameters:
listener
- the listener.
-
removeAttributeChangeListener
public void removeAttributeChangeListener(AttributeChangeListener listener)
Description copied from interface:AttributeCollection
Remove a listener on the attribute value changes.- Specified by:
removeAttributeChangeListener
in interfaceAttributeCollection
- Parameters:
listener
- the listener.
-
renameAttribute
public final boolean renameAttribute(String oldname, String newname)
Description copied from interface:AttributeCollection
Rename the attribute.If a attribute named
newname
already exists, this function will replyfalse
.This function is equivalent to
renameAttribute(oldname, newname, false)
.- Specified by:
renameAttribute
in interfaceAttributeCollection
- Parameters:
oldname
- is the name of the attribute to rename.newname
- is the new name of the attribute.- Returns:
false
if something wrong appends
-
-