Package org.apache.wicket.util.value
Class AttributeMap
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- java.util.LinkedHashMap<String,Object>
-
- org.apache.wicket.util.value.ValueMap
-
- org.apache.wicket.util.value.AttributeMap
-
public final class AttributeMap extends ValueMap
Map of values, extendingValueMapwith methods for generating (HTML) markup attributes.- Since:
- 1.2.6
- Author:
- Eelco Hillenius
- See Also:
Strings.escapeMarkup(CharSequence), Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Constructor Summary
Constructors Constructor Description AttributeMap()Constructs an emptyAttributeMap.AttributeMap(Map<String,Object> map)Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanputAttribute(String key, boolean value)Put a boolean attribute, removing it ifvalueis false or using the key as value otherwise, i.e.StringputAttribute(String key, CharSequence value)Put a string attribute, removing it if the string is empty (nor null).CharSequencetoCharSequence()Representation as encoded markup attributes.StringtoString()Representation as encoded markup attributes.-
Methods inherited from class org.apache.wicket.util.value.ValueMap
add, clear, getAsBoolean, getAsBoolean, getAsDouble, getAsDouble, getAsDuration, getAsDuration, getAsEnum, getAsEnum, getAsEnum, getAsInstant, getAsInteger, getAsInteger, getAsLong, getAsLong, getAsTime, getBoolean, getCharSequence, getDouble, getDouble, getDuration, getInstant, getInt, getInt, getKey, getLong, getLong, getString, getString, getStringArray, getStringValue, isImmutable, makeImmutable, put, putAll, remove
-
Methods inherited from class java.util.LinkedHashMap
containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
-
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, putIfAbsent, remove, replace, replace, size
-
Methods inherited from class java.util.AbstractMap
equals, hashCode
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, putIfAbsent, remove, replace, replace, replaceAll, size, values
-
-
-
-
Constructor Detail
-
AttributeMap
public AttributeMap()
Constructs an emptyAttributeMap.
-
AttributeMap
public AttributeMap(Map<String,Object> map)
Copy constructor.- Parameters:
map- aMapto be copied
-
-
Method Detail
-
putAttribute
public boolean putAttribute(String key, boolean value)
Put a boolean attribute, removing it ifvalueis false or using the key as value otherwise, i.e.value="value".- Parameters:
key- key of attributevalue-- Returns:
- previous value
-
putAttribute
public String putAttribute(String key, CharSequence value)
Put a string attribute, removing it if the string is empty (nor null).- Parameters:
key- key of attributevalue-- Returns:
- previous value
-
toString
public String toString()
Representation as encoded markup attributes.- Overrides:
toStringin classValueMap- Returns:
Stringrepresentation of thisValueMapconsistent with the tag-attribute style of markup elements. For example:a="x" b="y" c="z".- See Also:
Strings.escapeMarkup(CharSequence)
-
toCharSequence
public CharSequence toCharSequence()
Representation as encoded markup attributes.- See Also:
Strings.escapeMarkup(CharSequence)
-
-