KEYTYPE - Key typeVALUETYPE - Value type@NotThreadSafe public class MapBasedGenericAttributeContainer<KEYTYPE,VALUETYPE> extends AbstractGenericReadonlyAttributeContainer<KEYTYPE,VALUETYPE> implements IGenericAttributeContainer<KEYTYPE,VALUETYPE>, ICloneable<MapBasedGenericAttributeContainer<KEYTYPE,VALUETYPE>>
| Constructor and Description |
|---|
MapBasedGenericAttributeContainer() |
MapBasedGenericAttributeContainer(IGenericReadonlyAttributeContainer<? extends KEYTYPE,? extends VALUETYPE> aCont) |
MapBasedGenericAttributeContainer(KEYTYPE aKey,
VALUETYPE aValue) |
MapBasedGenericAttributeContainer(Map<? extends KEYTYPE,? extends VALUETYPE> aMap) |
| Modifier and Type | Method and Description |
|---|---|
EChange |
clear()
Reset the contents of the element to the after-construction state.
|
boolean |
containsAttribute(KEYTYPE aName)
Check if an attribute of the given name is contained.
|
boolean |
containsNoAttribute() |
boolean |
equals(Object o) |
Set<KEYTYPE> |
getAllAttributeNames() |
Map<KEYTYPE,VALUETYPE> |
getAllAttributes() |
Collection<VALUETYPE> |
getAllAttributeValues() |
int |
getAttributeCount() |
Enumeration<KEYTYPE> |
getAttributeNames()
Get an enumerator over all contained attribute names.
|
VALUETYPE |
getAttributeObject(KEYTYPE aName)
Get the attribute value associated to the given attribute name.
|
MapBasedGenericAttributeContainer<KEYTYPE,VALUETYPE> |
getClone() |
int |
hashCode() |
protected EContinue |
onBeforeRemoveAttribute(KEYTYPE aName)
Internal callback method that can be used to avoid removal of an attribute.
|
protected EContinue |
onBeforeSetAttributeValue(KEYTYPE aName,
VALUETYPE aValue)
Internal callback method that can be used to check constraints on an
attribute name or value.
|
EChange |
removeAttribute(KEYTYPE aName)
Remove the specified attribute from the container.
|
EChange |
setAttribute(KEYTYPE aName,
VALUETYPE aValue)
Set/overwrite an attribute value.
|
EChange |
setAttributes(IGenericReadonlyAttributeContainer<? extends KEYTYPE,? extends VALUETYPE> aValues)
Set/overwrite an arbitrary number of attribute values.
|
EChange |
setAttributes(Map<? extends KEYTYPE,? extends VALUETYPE> aValues)
Set/overwrite an arbitrary number of attribute values.
|
String |
toString() |
getAsBigDecimal, getAsBigInteger, getAsBoolean, getAsDouble, getAsInt, getAsLong, getAsString, getAttributeAsBigDecimal, getAttributeAsBigDecimal, getAttributeAsBigInteger, getAttributeAsBigInteger, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDouble, getAttributeAsDouble, getAttributeAsInt, getAttributeAsInt, getAttributeAsLong, getAttributeAsLong, getAttributeAsString, getAttributeAsString, getCastedAttribute, getCastedAttribute, getTypedAttribute, getTypedAttributeclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetAttributeAsBigDecimal, getAttributeAsBigDecimal, getAttributeAsBigInteger, getAttributeAsBigInteger, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDouble, getAttributeAsDouble, getAttributeAsInt, getAttributeAsInt, getAttributeAsLong, getAttributeAsLong, getAttributeAsString, getAttributeAsString, getCastedAttribute, getCastedAttribute, getTypedAttribute, getTypedAttributepublic MapBasedGenericAttributeContainer()
public MapBasedGenericAttributeContainer(@Nonnull KEYTYPE aKey, @Nullable VALUETYPE aValue)
public MapBasedGenericAttributeContainer(@Nonnull Map<? extends KEYTYPE,? extends VALUETYPE> aMap)
public MapBasedGenericAttributeContainer(@Nonnull IGenericReadonlyAttributeContainer<? extends KEYTYPE,? extends VALUETYPE> aCont)
public boolean containsAttribute(@Nullable KEYTYPE aName)
IGenericReadonlyAttributeContainercontainsAttribute in interface IGenericReadonlyAttributeContainer<KEYTYPE,VALUETYPE>aName - name of the attribute to checktrue if the attribute is contained, false
otherwise@Nonnull @ReturnsMutableCopy public Map<KEYTYPE,VALUETYPE> getAllAttributes()
getAllAttributes in interface IGenericReadonlyAttributeContainer<KEYTYPE,VALUETYPE>null map with all contained attributes.@Nullable public VALUETYPE getAttributeObject(@Nullable KEYTYPE aName)
IGenericReadonlyAttributeContainergetAttributeObject in interface IGenericReadonlyAttributeContainer<KEYTYPE,VALUETYPE>aName - the attribute namenull if no such value exists@OverrideOnDemand @Nonnull protected EContinue onBeforeSetAttributeValue(@Nonnull KEYTYPE aName, @Nonnull VALUETYPE aValue)
aName - 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 KEYTYPE aName, @Nullable VALUETYPE aValue)
IGenericAttributeContainersetAttribute in interface IGenericAttributeContainer<KEYTYPE,VALUETYPE>aName - 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.IGenericAttributeContainer.removeAttribute(Object)@Nonnull public final EChange setAttributes(@Nullable Map<? extends KEYTYPE,? extends VALUETYPE> aValues)
IGenericAttributeContainersetAttributes in interface IGenericAttributeContainer<KEYTYPE,VALUETYPE>aValues - The map of attributes to be set. May be null.EChange.CHANGED if something changed,
EChange.UNCHANGED otherwise.IGenericAttributeContainer.setAttribute(Object,Object)@Nonnull public final EChange setAttributes(@Nullable IGenericReadonlyAttributeContainer<? extends KEYTYPE,? extends VALUETYPE> aValues)
IGenericAttributeContainersetAttributes in interface IGenericAttributeContainer<KEYTYPE,VALUETYPE>aValues - The attributes to be set. May be null.EChange.CHANGED if something changed,
EChange.UNCHANGED otherwise.IGenericAttributeContainer.setAttribute(Object,Object)@OverrideOnDemand @Nonnull protected EContinue onBeforeRemoveAttribute(@Nonnull KEYTYPE aName)
aName - 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 KEYTYPE aName)
IGenericAttributeContainerremoveAttribute in interface IGenericAttributeContainer<KEYTYPE,VALUETYPE>aName - The attribute name to be removed. If it is null nothing
happens.EChange.CHANGED if something changed,
EChange.UNCHANGED otherwise.@Nonnull public Enumeration<KEYTYPE> getAttributeNames()
IGenericReadonlyAttributeContainergetAttributeNames in interface IGenericReadonlyAttributeContainer<KEYTYPE,VALUETYPE>@Nonnull @ReturnsMutableCopy public Set<KEYTYPE> getAllAttributeNames()
getAllAttributeNames in interface IGenericReadonlyAttributeContainer<KEYTYPE,VALUETYPE>@Nonnull @ReturnsMutableCopy public Collection<VALUETYPE> getAllAttributeValues()
getAllAttributeValues in interface IGenericReadonlyAttributeContainer<KEYTYPE,VALUETYPE>@Nonnegative public int getAttributeCount()
getAttributeCount in interface IGenericReadonlyAttributeContainer<KEYTYPE,VALUETYPE>public boolean containsNoAttribute()
containsNoAttribute in interface IGenericReadonlyAttributeContainer<KEYTYPE,VALUETYPE>true if this attribute container does not contain any
attribute at all, false if at least one attribute is
contained.@Nonnull public EChange clear()
IClearableclear in interface IClearableEChange.CHANGED if at least one element was cleared,
EChange.UNCHANGED otherwise.@Nonnull public MapBasedGenericAttributeContainer<KEYTYPE,VALUETYPE> getClone()
getClone in interface ICloneable<MapBasedGenericAttributeContainer<KEYTYPE,VALUETYPE>>Copyright © 2014 Philip Helger. All rights reserved.