Package org.apache.struts2.views.java

# Class Attributes

java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<String,String>
org.apache.struts2.views.java.Attributes

All Implemented Interfaces:
  `Serializable`, `Cloneable`, `Map<String,String>`

public class Attributes extends LinkedHashMap<String,String>
Map of tag attributes, used for rendering the tags

See Also:
  - 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
  `Attributes()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Attributes`
  `add(String key, String value)`
  `Attributes`
  `add(String key, String value, boolean encode)`
  `Attributes`
  `addDefaultToEmpty(String attrName, Object paramValue)`
  Add a key/value pair to the attributes, if the value is null, it will be set as an empty string.
  `Attributes`
  `addDefaultToEmpty(String attrName, Object paramValue, boolean encode)`
  Add a key/value pair to the attributes, if the value is null, it will be set as an empty string.
  `Attributes`
  `addIfExists(String attrName, Object paramValue)`
  Add a key/value pair to the attributes only if the value is not null.
  `Attributes`
  `addIfExists(String attrName, Object paramValue, boolean encode)`
  Add a key/value pair to the attributes only if the value is not null.
  `Attributes`
  `addIfTrue(String attrName, Object paramValue)`
  Add a key/value pair to the attributes only if the value is not null and is a boolean with a value of 'true'.

  ### Methods inherited from class java.util.LinkedHashMap

  `clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values`

  ### Methods inherited from class java.util.HashMap

  `clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size`

  ### Methods inherited from class java.util.AbstractMap

  `equals, hashCode, toString`

  ### 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, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size`

- ## Constructor Details

  - ### Attributes

    public Attributes()

- ## Method Details

  - ### add

    public Attributes add(String key, String value)

  - ### add

    public Attributes add(String key, String value, boolean encode)

  - ### addIfExists

    public Attributes addIfExists(String attrName, Object paramValue)
    Add a key/value pair to the attributes only if the value is not null. Value is html encoded
    Parameters:
      `attrName` - attribute name
      `paramValue` - value of attribute
    Returns:
      this

  - ### addIfExists

    public Attributes addIfExists(String attrName, Object paramValue, boolean encode)
    Add a key/value pair to the attributes only if the value is not null.
    Parameters:
      `attrName` - attribute name
      `paramValue` - value of attribute
      `encode` - html encode the value
    Returns:
      this

  - ### addIfTrue

    public Attributes addIfTrue(String attrName, Object paramValue)
    Add a key/value pair to the attributes only if the value is not null and is a boolean with a value of 'true'. Value is html encoded
    Parameters:
      `attrName` - attribute name
      `paramValue` - value of attribute
    Returns:
      this

  - ### addDefaultToEmpty

    public Attributes addDefaultToEmpty(String attrName, Object paramValue)
    Add a key/value pair to the attributes, if the value is null, it will be set as an empty string. Value is html encoded.
    Parameters:
      `attrName` - attribute name
      `paramValue` - value of attribute
    Returns:
      this

  - ### addDefaultToEmpty

    public Attributes addDefaultToEmpty(String attrName, Object paramValue, boolean encode)
    Add a key/value pair to the attributes, if the value is null, it will be set as an empty string.
    Parameters:
      `attrName` - attribute name
      `paramValue` - value of attribute
      `encode` - html encode the value
    Returns:
      this