public class RslAttributes
extends java.lang.Object
Constructor and Description |
---|
RslAttributes()
Creates an empty RslAttributes object.
|
RslAttributes(RslNode rslTree)
Creates a new RslAttributes object with
specified rsl parse tree.
|
RslAttributes(java.lang.String rsl)
Creates a new RslAttributes object from
specified RSL string.
|
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.String attribute,
java.lang.String value)
Adds a simple value to the list of values of a given
attribute.
|
void |
addMulti(java.lang.String attribute,
java.lang.String[] values)
Adds a list of values as a single value to the specified
attribute.
|
void |
addVariable(java.lang.String attribute,
java.lang.String varName,
java.lang.String value)
Adds a new variable definition to the specified variable definitions
attribute.
|
java.util.List |
get(java.lang.String attribute)
Deprecated.
use getMulti() instead.
|
java.lang.String |
getFirstValue(java.lang.String attribute)
Deprecated.
use getSingle() instead.
|
java.util.Map |
getMap(java.lang.String attribute)
Returns a key/value pair map for a specified attribute.
|
java.util.List |
getMulti(java.lang.String attribute)
Returns a list of strings for a specified attribute.
|
protected NameOpValue |
getRelation(java.lang.String attribute) |
RslNode |
getRslNode()
Returns the rsl parse tree.
|
java.lang.String |
getSingle(java.lang.String attribute)
Returns a string value of the specified attribute.
|
java.util.Map |
getVariables(java.lang.String attribute)
Returns a variable name/value pair map of variable definitions.
|
void |
remove(java.lang.String attribute)
Removes a specific attribute from attribute/value relations.
|
boolean |
remove(java.lang.String attribute,
java.lang.String value)
Removes a specific value from a list of values of the specified
attribute.
|
boolean |
removeMap(java.lang.String attribute,
java.lang.String key)
Removes a specific key from a list of values of the specified
attribute.
|
boolean |
removeVariable(java.lang.String attribute,
java.lang.String varName)
Removes a specific variable definition given a variable name.
|
void |
set(java.lang.String attribute,
java.lang.String value)
Sets the attribute value to the given value.
|
void |
setMulti(java.lang.String attribute,
java.lang.String[] values)
Sets the attribute value to the given list of values.
|
java.lang.String |
toRSL()
Returns the rsl.
|
protected RslNode rslTree
public RslAttributes()
public RslAttributes(RslNode rslTree)
rslTree
- the rsl parse tree.public RslAttributes(java.lang.String rsl) throws ParseException
rsl
- the rsl string.ParseException
- if the rsl cannot be parsed.public RslNode getRslNode()
public java.lang.String getSingle(java.lang.String attribute)
attribute
- the rsl attribute to return the value of.public java.util.List getMulti(java.lang.String attribute)
attribute
- the rsl attribute to return the values of.public java.util.Map getMap(java.lang.String attribute)
attribute
- the rsl attribute to return the key/value pair map of.public java.util.Map getVariables(java.lang.String attribute)
attribute
- the attribute that defines variables. Currently,
only 'rsl_substitution' is supported.public void addVariable(java.lang.String attribute, java.lang.String varName, java.lang.String value)
attribute
- the variable definitions attribute - rsl_subsititution.varName
- the variable name to add.value
- the value of the variable to add.public boolean removeVariable(java.lang.String attribute, java.lang.String varName)
attribute
- the attribute that defines variable definitions.varName
- the name of the variable to remove.public void remove(java.lang.String attribute)
attribute
- the attribute name to remove.public boolean remove(java.lang.String attribute, java.lang.String value)
attribute
- the attribute from which to remote the value from.value
- the specific value to remove.public boolean removeMap(java.lang.String attribute, java.lang.String key)
attribute
- the attribute to remove the key from.key
- the key to remove.protected NameOpValue getRelation(java.lang.String attribute)
public void set(java.lang.String attribute, java.lang.String value)
attribute
- the attribute to set the value of.value
- the value to add.public void add(java.lang.String attribute, java.lang.String value)
attribute
- the attribute to add the value to.value
- the value to add.public void setMulti(java.lang.String attribute, java.lang.String[] values)
attribute
- the attribute to set the value of.values
- the list of values to add.public void addMulti(java.lang.String attribute, java.lang.String[] values)
attribute
- the attribute to add the list of values to.values
- the values to add.public java.lang.String getFirstValue(java.lang.String attribute)
public java.util.List get(java.lang.String attribute)
public java.lang.String toRSL()