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.
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
Modifier and TypeMethodDescriptionvoid
void
void
void
clear()
getName()
Get the name of this attribute.getValue()
Get the first value from the Set of attribute values, or null if the attribute has no values.int
Get a count of the number of values this attribute has (0-n).Get the Set of values for this attribute.String[]
Return the attributes values as a String array.void
removeValue
(String value) void
removeValues
(String[] values) void
removeValues
(Set<String> values)
-
Method Details
-
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
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
-
addValues
-
addValues
-
removeValue
-
removeValues
-
removeValues
-
clear
void clear()
-