java.lang.Object
com.aoapps.taglib.MutableGlobalAttributes
- All Implemented Interfaces:
Freezable<GlobalAttributes>
,GlobalAttributes
public class MutableGlobalAttributes
extends Object
implements GlobalAttributes, Freezable<GlobalAttributes>
Builder for
GlobalAttributes
instances.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds the data with the provided HTML attribute name and value, replacing any attribute that already exists.Adds all the data with the provided HTML attribute names and values, replacing any attributes that already exist.freeze()
Gets an immutable, thread-safe instance.getClazz()
Getter required.getData()
Gets the HTML data attributes or an empty map when there are none.getDir()
getId()
getStyle()
removeData
(Iterable<? extends String> attrNames) Removes the data with the provided HTML attribute names.removeData
(String attrName) Removes the data with the provided HTML attribute name.Replaces all the data with the provided HTML attribute names and values.
-
Constructor Details
-
MutableGlobalAttributes
public MutableGlobalAttributes() -
MutableGlobalAttributes
-
-
Method Details
-
getId
- Specified by:
getId
in interfaceGlobalAttributes
-
setId
-
getClazz
Description copied from interface:GlobalAttributes
Getter required. Because without it, we get the exception:Unable to find setter method for attribute: class
- Specified by:
getClazz
in interfaceGlobalAttributes
-
setClazz
-
getData
Description copied from interface:GlobalAttributes
Gets the HTML data attributes or an empty map when there are none.- Specified by:
getData
in interfaceGlobalAttributes
-
setData
public MutableGlobalAttributes setData(Map<? extends String, ?> data) throws IllegalArgumentExceptionReplaces all the data with the provided HTML attribute names and values. Entries will anull
value are not added.- Throws:
IllegalArgumentException
- WhenattrName
is not valid- See Also:
-
addData
public MutableGlobalAttributes addData(Map<? extends String, ?> data) throws IllegalArgumentExceptionAdds all the data with the provided HTML attribute names and values, replacing any attributes that already exist. Entries with anull
value will remove any existing attribute.- Throws:
IllegalArgumentException
- WhenattrName
is not valid
-
addData
public MutableGlobalAttributes addData(String attrName, Object value) throws IllegalArgumentException Adds the data with the provided HTML attribute name and value, replacing any attribute that already exists. When value isnull
, will remove an existing attribute.- Throws:
IllegalArgumentException
- WhenattrName
is not valid- See Also:
-
removeData
Removes the data with the provided HTML attribute names. -
removeData
Removes the data with the provided HTML attribute name. -
getDir
- Specified by:
getDir
in interfaceGlobalAttributes
-
setDir
- Throws:
IllegalArgumentException
-
getStyle
- Specified by:
getStyle
in interfaceGlobalAttributes
-
setStyle
-
freeze
Gets an immutable, thread-safe instance.- Specified by:
freeze
in interfaceFreezable<GlobalAttributes>
- Returns:
- The instance or
ImmutableGlobalAttributes.EMPTY
when empty. - See Also:
-