Interface Attribute
- All Superinterfaces:
Collection<ByteString>,Iterable<ByteString>,Set<ByteString>
- All Known Implementing Classes:
AbstractAttribute,LinkedAttribute
Any methods which perform comparisons between attribute values use the equality matching rule associated with the attribute description.
Any methods which accept Object based attribute values convert the
attribute values to instances of ByteString using
ByteString.valueOfObject(Object).
-
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds all of the provided attribute values to this attribute if they are not already present (optional operation).booleanadd(ByteString value) Addsvalueto this attribute if it is not already present (optional operation).booleanaddAll(Collection<? extends ByteString> values) Adds all of the attribute values contained invaluesto this attribute if they are not already present (optional operation).<T> booleanaddAll(Collection<T> values, Collection<? super T> duplicateValues) Adds all of the attribute values contained invaluesto this attribute if they are not already present (optional operation).voidclear()Removes all of the attribute values from this attribute (optional operation).booleanReturnstrueif this attribute containsvalue.booleancontainsAll(Collection<?> values) Returnstrueif this attribute contains all of the attribute values contained invalues.booleanReturnstrueifobjectis an attribute which is equal to this attribute.Returns the first attribute value in this attribute.Returns the first attribute value in this attribute decoded as a UTF-8 string.Returns the attribute description of this attribute, which includes its attribute type and any options.Returns the string representation of the attribute description of this attribute, which includes its attribute type and any options.inthashCode()Returns the hash code for this attribute.booleanisEmpty()Returnstrueif this attribute contains no attribute values.iterator()Returns an iterator over the attribute values in this attribute.parse()Returns a parser for this attribute which can be used for decoding values as different types of object.booleanRemovesvaluefrom this attribute if it is present (optional operation).booleanremoveAll(Collection<?> values) Removes all of the attribute values contained invaluesfrom this attribute if they are present (optional operation).<T> booleanremoveAll(Collection<T> values, Collection<? super T> missingValues) Removes all of the attribute values contained invaluesfrom this attribute if they are present (optional operation).booleanretainAll(Collection<?> values) Retains only the attribute values in this attribute which are contained invalues(optional operation).<T> booleanretainAll(Collection<T> values, Collection<? super T> missingValues) Retains only the attribute values in this attribute which are contained invalues(optional operation).intsize()Returns the number of attribute values in this attribute.toArray()Returns an array containing all of the attribute values contained in this attribute.<T> T[]toArray(T[] array) Returns an array containing all of the attribute values in this attribute; the runtime type of the returned array is that of the specified array.toString()Returns a string representation of this attribute.Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
spliterator
-
Method Details
-
add
Addsvalueto this attribute if it is not already present (optional operation). If this attribute already containsvalue, the call leaves the attribute unchanged and returnsfalse.- Specified by:
addin interfaceCollection<ByteString>- Specified by:
addin interfaceSet<ByteString>- Parameters:
value- The attribute value to be added to this attribute.- Returns:
trueif this attribute changed as a result of this call.- Throws:
UnsupportedOperationException- If this attribute does not support addition of attribute values.NullPointerException- Ifvaluewasnull.
-
add
Adds all of the provided attribute values to this attribute if they are not already present (optional operation).Any attribute values which are not instances of
ByteStringwill be converted using theByteString.valueOfObject(Object)method.- Parameters:
values- The attribute values to be added to this attribute.- Returns:
trueif this attribute changed as a result of this call.- Throws:
UnsupportedOperationException- If this attribute does not support addition of attribute values.NullPointerException- Ifvalueswasnull.
-
addAll
Adds all of the attribute values contained invaluesto this attribute if they are not already present (optional operation).An invocation of this method is equivalent to:
attribute.addAll(values, null);
- Specified by:
addAllin interfaceCollection<ByteString>- Specified by:
addAllin interfaceSet<ByteString>- Parameters:
values- The attribute values to be added to this attribute.- Returns:
trueif this attribute changed as a result of this call.- Throws:
UnsupportedOperationException- If this attribute does not support addition of attribute values.NullPointerException- Ifvalueswasnull.
-
addAll
Adds all of the attribute values contained invaluesto this attribute if they are not already present (optional operation). Any attribute values which are already present will be added toduplicateValuesif specified.Any attribute values which are not instances of
ByteStringwill be converted using theByteString.valueOfObject(Object)method.- Type Parameters:
T- The type of the attribute value objects being added.- Parameters:
values- The attribute values to be added to this attribute.duplicateValues- A collection into which duplicate values will be added, ornullif duplicate values should not be saved.- Returns:
trueif this attribute changed as a result of this call.- Throws:
UnsupportedOperationException- If this attribute does not support addition of attribute values.NullPointerException- Ifvalueswasnull.
-
clear
void clear()Removes all of the attribute values from this attribute (optional operation). This attribute will be empty after this call returns.- Specified by:
clearin interfaceCollection<ByteString>- Specified by:
clearin interfaceSet<ByteString>- Throws:
UnsupportedOperationException- If this attribute does not support removal of attribute values.
-
contains
Returnstrueif this attribute containsvalue.If
valueis not an instance ofByteStringthen it will be converted using theByteString.valueOfObject(Object)method.- Specified by:
containsin interfaceCollection<ByteString>- Specified by:
containsin interfaceSet<ByteString>- Parameters:
value- The attribute value whose presence in this attribute is to be tested.- Returns:
trueif this attribute containsvalue, orfalseif not.- Throws:
NullPointerException- Ifvaluewasnull.
-
containsAll
Returnstrueif this attribute contains all of the attribute values contained invalues.Any attribute values which are not instances of
ByteStringwill be converted using theByteString.valueOfObject(Object)method.- Specified by:
containsAllin interfaceCollection<ByteString>- Specified by:
containsAllin interfaceSet<ByteString>- Parameters:
values- The attribute values whose presence in this attribute is to be tested.- Returns:
trueif this attribute contains all of the attribute values contained invalues, orfalseif not.- Throws:
NullPointerException- Ifvalueswasnull.
-
equals
Returnstrueifobjectis an attribute which is equal to this attribute. Two attributes are considered equal if their attribute descriptions are equal, they both have the same number of attribute values, and every attribute value contained in the first attribute is also contained in the second attribute.- Specified by:
equalsin interfaceCollection<ByteString>- Specified by:
equalsin interfaceSet<ByteString>- Overrides:
equalsin classObject- Parameters:
object- The object to be tested for equality with this attribute.- Returns:
trueifobjectis an attribute which is equal to this attribute, orfalseif not.
-
firstValue
Returns the first attribute value in this attribute.- Returns:
- The first attribute value in this attribute.
- Throws:
NoSuchElementException- If this attribute is empty.
-
firstValueAsString
Returns the first attribute value in this attribute decoded as a UTF-8 string.- Returns:
- The first attribute value in this attribute decoded as a UTF-8 string.
- Throws:
NoSuchElementException- If this attribute is empty.
-
getAttributeDescription
Returns the attribute description of this attribute, which includes its attribute type and any options.- Returns:
- The attribute description.
-
getAttributeDescriptionAsString
Returns the string representation of the attribute description of this attribute, which includes its attribute type and any options.- Returns:
- The string representation of the attribute description.
-
hashCode
int hashCode()Returns the hash code for this attribute. It will be calculated as the sum of the hash codes of the attribute description and all of the attribute values.- Specified by:
hashCodein interfaceCollection<ByteString>- Specified by:
hashCodein interfaceSet<ByteString>- Overrides:
hashCodein classObject- Returns:
- The hash code for this attribute.
-
isEmpty
boolean isEmpty()Returnstrueif this attribute contains no attribute values.- Specified by:
isEmptyin interfaceCollection<ByteString>- Specified by:
isEmptyin interfaceSet<ByteString>- Returns:
trueif this attribute contains no attribute values.
-
iterator
Returns an iterator over the attribute values in this attribute. The attribute values are returned in no particular order, unless the implementation of this attribute provides such a guarantee.- Specified by:
iteratorin interfaceCollection<ByteString>- Specified by:
iteratorin interfaceIterable<ByteString>- Specified by:
iteratorin interfaceSet<ByteString>- Returns:
- An iterator over the attribute values in this attribute.
-
parse
Returns a parser for this attribute which can be used for decoding values as different types of object.- Returns:
- A parser for this attribute.
-
remove
Removesvaluefrom this attribute if it is present (optional operation). If this attribute does not containvalue, the call leaves the attribute unchanged and returnsfalse.If
valueis not an instance ofByteStringthen it will be converted using theByteString.valueOfObject(Object)method.- Specified by:
removein interfaceCollection<ByteString>- Specified by:
removein interfaceSet<ByteString>- Parameters:
value- The attribute value to be removed from this attribute.- Returns:
trueif this attribute changed as a result of this call.- Throws:
UnsupportedOperationException- If this attribute does not support removal of attribute values.NullPointerException- Ifvaluewasnull.
-
removeAll
Removes all of the attribute values contained invaluesfrom this attribute if they are present (optional operation).Any attribute values which are not instances of
ByteStringwill be converted using theByteString.valueOfObject(Object)method.An invocation of this method is equivalent to:
attribute.removeAll(values, null);
- Specified by:
removeAllin interfaceCollection<ByteString>- Specified by:
removeAllin interfaceSet<ByteString>- Parameters:
values- The attribute values to be removed from this attribute.- Returns:
trueif this attribute changed as a result of this call.- Throws:
UnsupportedOperationException- If this attribute does not support removal of attribute values.NullPointerException- Ifvalueswasnull.
-
removeAll
Removes all of the attribute values contained invaluesfrom this attribute if they are present (optional operation). Any attribute values which are not already present will be added tomissingValuesif specified.Any attribute values which are not instances of
ByteStringwill be converted using theByteString.valueOfObject(Object)method.- Type Parameters:
T- The type of the attribute value objects being removed.- Parameters:
values- The attribute values to be removed from this attribute.missingValues- A collection into which missing values will be added, ornullif missing values should not be saved.- Returns:
trueif this attribute changed as a result of this call.- Throws:
UnsupportedOperationException- If this attribute does not support removal of attribute values.NullPointerException- Ifvalueswasnull.
-
retainAll
Retains only the attribute values in this attribute which are contained invalues(optional operation).Any attribute values which are not instances of
ByteStringwill be converted using theByteString.valueOfObject(Object)method.An invocation of this method is equivalent to:
attribute.retainAll(values, null);
- Specified by:
retainAllin interfaceCollection<ByteString>- Specified by:
retainAllin interfaceSet<ByteString>- Parameters:
values- The attribute values to be retained in this attribute.- Returns:
trueif this attribute changed as a result of this call.- Throws:
UnsupportedOperationException- If this attribute does not support removal of attribute values.NullPointerException- Ifvalueswasnull.
-
retainAll
Retains only the attribute values in this attribute which are contained invalues(optional operation). Any attribute values which are not already present will be added tomissingValuesif specified.Any attribute values which are not instances of
ByteStringwill be converted using theByteString.valueOfObject(Object)method.- Type Parameters:
T- The type of the attribute value objects being retained.- Parameters:
values- The attribute values to be retained in this attribute.missingValues- A collection into which missing values will be added, ornullif missing values should not be saved.- Returns:
trueif this attribute changed as a result of this call.- Throws:
UnsupportedOperationException- If this attribute does not support removal of attribute values.NullPointerException- Ifvalueswasnull.
-
size
int size()Returns the number of attribute values in this attribute.- Specified by:
sizein interfaceCollection<ByteString>- Specified by:
sizein interfaceSet<ByteString>- Returns:
- The number of attribute values in this attribute.
-
toArray
ByteString[] toArray()Returns an array containing all of the attribute values contained in this attribute.If this attribute makes any guarantees as to what order its attribute values are returned by its iterator, this method must return the attribute values in the same order.
The returned array will be "safe" in that no references to it are maintained by this attribute. The caller is thus free to modify the returned array.
- Specified by:
toArrayin interfaceCollection<ByteString>- Specified by:
toArrayin interfaceSet<ByteString>- Returns:
- An array containing all of the attribute values contained in this attribute.
-
toArray
Returns an array containing all of the attribute values in this attribute; the runtime type of the returned array is that of the specified array.If the set fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this attribute. If this attribute fits in the specified array with room to spare (i.e., the array has more elements than this attribute), the elements in the array immediately following the end of the set is set to
null.If this attribute makes any guarantees as to what order its attribute values are returned by its iterator, this method must return the attribute values in the same order.
- Specified by:
toArrayin interfaceCollection<ByteString>- Specified by:
toArrayin interfaceSet<ByteString>- Type Parameters:
T- The type of elements contained inarray.- Parameters:
array- An array into which the elements of this attribute should be put.- Returns:
- An array containing all of the attribute values contained in this attribute.
- Throws:
ArrayStoreException- If the runtime type ofarrayis not a supertype ofByteString.NullPointerException- Ifarraywasnull.
-
toString
Returns a string representation of this attribute.
-