@NotThreadSafe public class MapBasedAttributeContainer extends AbstractReadonlyAttributeContainer implements IAttributeContainer, ICloneable<MapBasedAttributeContainer>
| Constructor and Description |
|---|
MapBasedAttributeContainer() |
MapBasedAttributeContainer(IReadonlyAttributeContainer aCont) |
MapBasedAttributeContainer(Map<String,?> aMap) |
| Modifier and Type | Method and Description |
|---|---|
EChange |
clear()
Reset the contents of the element to the after-construction state.
|
boolean |
containsAttribute(String sName)
Check if an attribute of the given name is contained.
|
boolean |
containsNoAttribute() |
boolean |
equals(Object o) |
Set<String> |
getAllAttributeNames() |
Map<String,Object> |
getAllAttributes() |
Collection<Object> |
getAllAttributeValues() |
boolean |
getAndSetAttributeFlag(String sName)
Atomic operation to set a flag to
true if it was previously
set to false (meaning not existing). |
int |
getAttributeCount() |
Enumeration<String> |
getAttributeNames()
Get an enumerator over all contained attribute names.
|
Object |
getAttributeObject(String sName)
Get the attribute value associated to the given attribute name.
|
MapBasedAttributeContainer |
getClone() |
int |
hashCode() |
protected EContinue |
onBeforeRemoveAttribute(String sName)
Internal callback method that can be used to avoid removal of an attribute.
|
protected EContinue |
onBeforeSetAttributeValue(String sName,
Object aValue)
Internal callback method that can be used to check constraints on an
attribute name or value.
|
EChange |
removeAttribute(String sName)
Remove the specified attribute from the container.
|
EChange |
setAttribute(String sName,
boolean dValue)
Set/overwrite an in attribute value.
|
EChange |
setAttribute(String sName,
double dValue)
Set/overwrite an in attribute value.
|
EChange |
setAttribute(String sName,
int nValue)
Set/overwrite an in attribute value.
|
EChange |
setAttribute(String sName,
long nValue)
Set/overwrite an in attribute value.
|
EChange |
setAttribute(String sName,
Object aValue)
Set/overwrite an attribute value.
|
EChange |
setAttributes(IReadonlyAttributeContainer aValues)
Set/overwrite an arbitrary number of attribute values.
|
EChange |
setAttributes(Map<String,?> aValues)
Set/overwrite an arbitrary number of attribute values.
|
String |
toString() |
getAsBoolean, getAsDouble, getAsInt, getAsLong, getAsString, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDouble, getAttributeAsDouble, getAttributeAsInt, getAttributeAsInt, getAttributeAsLong, getAttributeAsLong, getAttributeAsString, getAttributeAsString, getCastedAttribute, getCastedAttribute, getTypedAttribute, getTypedAttributeclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDouble, getAttributeAsDouble, getAttributeAsInt, getAttributeAsInt, getAttributeAsLong, getAttributeAsLong, getAttributeAsString, getAttributeAsString, getCastedAttribute, getCastedAttribute, getTypedAttribute, getTypedAttributepublic MapBasedAttributeContainer()
public MapBasedAttributeContainer(@Nonnull IReadonlyAttributeContainer aCont)
public boolean containsAttribute(@Nullable String sName)
IReadonlyAttributeContainercontainsAttribute in interface IReadonlyAttributeContainersName - name of the attribute to checktrue if the attribute is contained, false
otherwise@Nonnull @ReturnsMutableCopy public Map<String,Object> getAllAttributes()
getAllAttributes in interface IReadonlyAttributeContainernull map with all contained attributes.@Nullable public Object getAttributeObject(@Nullable String sName)
IReadonlyAttributeContainergetAttributeObject in interface IReadonlyAttributeContainersName - the attribute namenull if no such value exists@OverrideOnDemand @Nonnull protected EContinue onBeforeSetAttributeValue(@Nonnull String sName, @Nonnull Object aValue)
sName - The attribute name. Never null.aValue - The attribute value. Never null.EContinue.CONTINUE to indicate that the name-value-pair is
OK. May not be null.@Nonnull public EChange setAttribute(@Nonnull String sName, @Nullable Object aValue)
IAttributeContainersetAttribute in interface IAttributeContainersName - The name of the attribute. May not be null.aValue - The value of the attribute. If it is null, the value
will be removed.EChange.CHANGED if something changed,
EChange.UNCHANGED otherwise.IAttributeContainer.removeAttribute(String)@Nonnull public final EChange setAttribute(@Nonnull String sName, boolean dValue)
IAttributeContainersetAttribute (sName, Boolean.valueOf (bValue));setAttribute in interface IAttributeContainersName - The name of the attribute. May not be null.dValue - The value of the attribute.EChange.CHANGED if something changed,
EChange.UNCHANGED otherwise.IAttributeContainer.removeAttribute(String)@Nonnull public final EChange setAttribute(@Nonnull String sName, int nValue)
IAttributeContainersetAttribute (sName, Integer.valueOf (nValue));setAttribute in interface IAttributeContainersName - The name of the attribute. May not be null.nValue - The value of the attribute.EChange.CHANGED if something changed,
EChange.UNCHANGED otherwise.IAttributeContainer.removeAttribute(String)@Nonnull public final EChange setAttribute(@Nonnull String sName, long nValue)
IAttributeContainersetAttribute (sName, Long.valueOf (nValue));setAttribute in interface IAttributeContainersName - The name of the attribute. May not be null.nValue - The value of the attribute.EChange.CHANGED if something changed,
EChange.UNCHANGED otherwise.IAttributeContainer.removeAttribute(String)@Nonnull public final EChange setAttribute(@Nonnull String sName, double dValue)
IAttributeContainersetAttribute (sName, Double.valueOf (nValue));setAttribute in interface IAttributeContainersName - The name of the attribute. May not be null.dValue - The value of the attribute.EChange.CHANGED if something changed,
EChange.UNCHANGED otherwise.IAttributeContainer.removeAttribute(String)@Nonnull public final EChange setAttributes(@Nullable Map<String,?> aValues)
IAttributeContainersetAttributes in interface IAttributeContaineraValues - The map of attributes to be set. May be null.EChange.CHANGED if something changed,
EChange.UNCHANGED otherwise.IAttributeContainer.setAttribute(String,Object)@Nonnull public final EChange setAttributes(@Nullable IReadonlyAttributeContainer aValues)
IAttributeContainersetAttributes in interface IAttributeContaineraValues - The attributes to be set. May be null.EChange.CHANGED if something changed,
EChange.UNCHANGED otherwise.IAttributeContainer.setAttribute(String,Object)@OverrideOnDemand @Nonnull protected EContinue onBeforeRemoveAttribute(@Nonnull String sName)
sName - The attribute name. Never null.EContinue.CONTINUE to indicate that the name-value-pair is
OK. May not be null.@Nonnull public EChange removeAttribute(@Nullable String sName)
IAttributeContainerremoveAttribute in interface IAttributeContainersName - The attribute name to be removed. If it is null nothing
happens.EChange.CHANGED if something changed,
EChange.UNCHANGED otherwise.@Nonnull public Enumeration<String> getAttributeNames()
IReadonlyAttributeContainergetAttributeNames in interface IReadonlyAttributeContainer@Nonnull @ReturnsMutableCopy public Set<String> getAllAttributeNames()
getAllAttributeNames in interface IReadonlyAttributeContainer@Nonnull @ReturnsMutableCopy public Collection<Object> getAllAttributeValues()
getAllAttributeValues in interface IReadonlyAttributeContainer@Nonnegative public int getAttributeCount()
getAttributeCount in interface IReadonlyAttributeContainerpublic boolean containsNoAttribute()
containsNoAttribute in interface IReadonlyAttributeContainertrue if this attribute container does not contain any
attribute at all, false if at least one attribute is
contained.public boolean getAndSetAttributeFlag(@Nonnull String sName)
IAttributeContainertrue if it was previously
set to false (meaning not existing). There is no possibility
to define a value for this flag. The value used is Boolean.TRUE.
IReadonlyAttributeContainer.containsAttribute(String) can be used to check if the attribute is
already present.getAndSetAttributeFlag in interface IAttributeContainersName - The name of the flag to set.false is returned, whereas if the flag was
already present, true is returned. Any other than the
first call for the same flag is always returning true.@Nonnull public EChange clear()
IClearableclear in interface IClearableEChange.CHANGED if at least one element was cleared,
EChange.UNCHANGED otherwise.@Nonnull public MapBasedAttributeContainer getClone()
getClone in interface ICloneable<MapBasedAttributeContainer>Copyright © 2006–2015 phloc systems. All rights reserved.