public class NameValuePairs extends java.lang.Object implements AttributeList, ExprValueSupplier
This class provides methods for setting and getting values either by index or by name.
| Constructor and Description |
|---|
NameValuePairs()
Creates an empty attribute list.
|
NameValuePairs(int size)
Constructs a new attribute list with a specified initial capacity.
|
NameValuePairs(java.lang.String[] nameArr, java.lang.Object[] valArr) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
java.lang.Object |
getAttribute(int index)
Gets the value of an attribute identified by its index.
|
java.lang.Object |
getAttribute(java.lang.String name)
Gets the value of an attribute identified by name.
|
int |
getAttributeCount()
Counts the attributes.
|
int |
getAttributeIndexOf(java.lang.String name)
Gets the index of a named attribute.
|
java.lang.String[] |
getAttributeNames()
Returns an array of attribute names in this list.
|
java.lang.Object[] |
getAttributeValues()
Returns an array of attribute values in this list.
|
java.lang.Object |
getExprVarVal(java.lang.String varName) |
void |
setAttribute(int index, java.lang.Object value)
Sets the value for the specified attribute.
|
void |
setAttribute(java.lang.String name, java.lang.Object value)
Sets the value for the named attribute.
|
void |
setExprVarVal(java.lang.String varName, java.lang.Object val) |
public NameValuePairs()
public NameValuePairs(int size)
size - the initial cacpacity.
public NameValuePairs(java.lang.String[] nameArr,
java.lang.Object[] valArr)
public java.lang.Object getAttribute(int index)
getAttribute in interface AttributeListindex - the attribute's index.null if index is out of range.public java.lang.Object getAttribute(java.lang.String name)
getAttribute in interface AttributeListname - the attribute's name.null if index is out of range.
public void setAttribute(int index,
java.lang.Object value)
setAttribute in interface AttributeListindex - the attribute index.value - the attribute's new value.
public void setAttribute(java.lang.String name,
java.lang.Object value)
setAttribute in interface AttributeListname - the attribute name.value - the attribute's new value.public int getAttributeCount()
getAttributeCount in interface AttributeListpublic int getAttributeIndexOf(java.lang.String name)
getAttributeIndexOf in interface AttributeListname - the attribute's name.public java.lang.String[] getAttributeNames()
AttributeListgetAttributeNames in interface AttributeListpublic java.lang.Object[] getAttributeValues()
AttributeListgetAttributeValues in interface AttributeListpublic void clear()
public java.lang.Object getExprVarVal(java.lang.String varName)
getExprVarVal in interface ExprValueSupplier
public void setExprVarVal(java.lang.String varName,
java.lang.Object val)
setExprVarVal in interface ExprValueSupplier