Interface Attribute
-
- All Known Implementing Classes:
AttributeImpl
public interface Attribute
The Attribute interface defines an interface for interacting with individual Attributes. It is a read-only interface.
Note that, because the collection used to hold attribute values is a Set, the attribute can be multi-valued. Each value must be distinct, however -- it is not a bag that can contain multiple instances of the same value.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addValue(String value)
void
addValues(String[] values)
void
addValues(Set<String> values)
void
clear()
String
getName()
Get the name of this attribute.String
getValue()
Get the first value from the Set of attribute values, or null if the attribute has no values.int
getValueCount()
Get a count of the number of values this attribute has (0-n).Set<String>
getValues()
Get the Set of values for this attribute.String[]
getValuesAsArray()
Return the attributes values as a String array.void
removeValue(String value)
void
removeValues(String[] values)
void
removeValues(Set<String> values)
-
-
-
Method Detail
-
getName
String getName()
Get the name of this attribute.- Returns:
- The name.
-
getValueCount
int getValueCount()
Get a count of the number of values this attribute has (0-n).- Returns:
- The value count.
-
getValue
String getValue()
Get the first value from the Set of attribute values, or null if the attribute has no values. This is a shorthand method that should be useful for single-valued attributes, but note that there are no guarantees about which value is returned in the case that there are multiple values. The value returned will be whichever value the underlying Set implementation returns first.- Returns:
- The attribute value.
-
getValues
Set<String> getValues()
Get the Set of values for this attribute. The Set returned is a copy of the original; changes to this Set will not affect the original.- Returns:
- The attribute values Set.
-
getValuesAsArray
String[] getValuesAsArray()
Return the attributes values as a String array. Note that this array can be zero-length in the case that there are no values.- Returns:
- The attribute values array.
-
addValue
void addValue(String value)
-
addValues
void addValues(String[] values)
-
removeValue
void removeValue(String value)
-
removeValues
void removeValues(String[] values)
-
clear
void clear()
-
-