Class AbstractAttribute
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<ByteString>
-
- org.forgerock.opendj.ldap.AbstractAttribute
-
- All Implemented Interfaces:
Iterable<ByteString>,Collection<ByteString>,Set<ByteString>,Attribute
- Direct Known Subclasses:
LinkedAttribute
public abstract class AbstractAttribute extends AbstractSet<ByteString> implements Attribute
This class provides a skeletal implementation of theAttributeinterface, to minimize the effort required to implement this interface.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractAttribute()Sole constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanadd(Object... values)Adds all of the provided attribute values to this attribute if they are 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).booleancontains(Object obj)Returnstrueif this attribute containsvalue.booleancontainsAll(Collection<?> values)Returnstrueif this attribute contains all of the attribute values contained invalues.booleanequals(Object object)Returnstrueifobjectis an attribute which is equal to this attribute.ByteStringfirstValue()Returns the first attribute value in this attribute.inthashCode()Returns the hash code for this attribute.booleanisEmpty()Returnstrueif this attribute contains no attribute values.abstract Iterator<ByteString>iterator()Returns an iterator over the attribute values in this attribute.ConditionResultmatchesApproximateAssertion(Assertion assertion, ByteSequence rawAssertion)Indicates whether this attribute matches the specified assertion using the attribute's default approximate matching rule.ConditionResultmatchesEqualityAssertion(Assertion assertion, ByteSequence rawAssertion)Indicates whether this attribute matches the specified assertion using the attribute's default equality matching rule.ConditionResultmatchesGreaterOrEqualAssertion(Assertion assertion, ByteSequence rawAssertion)Indicates whether this attribute matches the specified assertion using the attribute's default ordering matching rule.ConditionResultmatchesLessOrEqualAssertion(Assertion assertion, ByteSequence rawAssertion)Indicates whether this attribute matches the specified assertion using the attribute's default ordering matching rule.ConditionResultmatchesSubstringAssertion(Assertion assertion, ByteSequence rawInitialSubstring, List<? extends ByteSequence> rawAnySubstrings, ByteSequence rawFinalSubstring)Indicates whether this attribute matches the specified assertion using the attribute's default ordering matching rule.AttributeParserparse()Returns a parser for this attribute which can be used for decoding values as different types of object.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.ByteString[]toArray()Returns an array containing all of the attribute values contained in this attribute.StringtoString()Returns a string representation of this attribute.-
Methods inherited from class java.util.AbstractCollection
add, clear, remove, toArray
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.forgerock.opendj.ldap.Attribute
add, clear, firstValueAsString, getAttributeDescription, getAttributeDescriptionAsString, isReal, isVirtual, put, put, remove, toArray
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
-
-
-
Method Detail
-
add
public boolean add(Object... values)
Description copied from interface:AttributeAdds 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.
-
addAll
public boolean addAll(Collection<? extends ByteString> values)
Description copied from interface:AttributeAdds 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 interfaceAttribute- Specified by:
addAllin interfaceCollection<ByteString>- Specified by:
addAllin interfaceSet<ByteString>- Overrides:
addAllin classAbstractCollection<ByteString>- Parameters:
values- The attribute values to be added to this attribute.- Returns:
trueif this attribute changed as a result of this call.
-
addAll
public <T> boolean addAll(Collection<T> values, Collection<? super T> duplicateValues)
Description copied from interface:AttributeAdds 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.- Specified by:
addAllin interfaceAttribute- 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.
-
contains
public boolean contains(Object obj)
Description copied from interface:AttributeReturnstrueif this attribute containsvalue.If
valueis not an instance ofByteStringthen it will be converted using theByteString.valueOfObject(Object)method.- Specified by:
containsin interfaceAttribute- Specified by:
containsin interfaceCollection<ByteString>- Specified by:
containsin interfaceSet<ByteString>- Overrides:
containsin classAbstractCollection<ByteString>- Parameters:
obj- The attribute value whose presence in this attribute is to be tested.- Returns:
trueif this attribute containsvalue, orfalseif not.
-
containsAll
public boolean containsAll(Collection<?> values)
Description copied from interface:AttributeReturnstrueif 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 interfaceAttribute- Specified by:
containsAllin interfaceCollection<ByteString>- Specified by:
containsAllin interfaceSet<ByteString>- Overrides:
containsAllin classAbstractCollection<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.
-
equals
public boolean equals(Object object)
Description copied from interface:AttributeReturnstrueifobjectis 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 interfaceAttribute- Specified by:
equalsin interfaceCollection<ByteString>- Specified by:
equalsin interfaceSet<ByteString>- Overrides:
equalsin classAbstractSet<ByteString>- 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
public ByteString firstValue()
Description copied from interface:AttributeReturns the first attribute value in this attribute.- Specified by:
firstValuein interfaceAttribute- Returns:
- The first attribute value in this attribute.
-
hashCode
public int hashCode()
Description copied from interface:AttributeReturns 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 interfaceAttribute- Specified by:
hashCodein interfaceCollection<ByteString>- Specified by:
hashCodein interfaceSet<ByteString>- Overrides:
hashCodein classAbstractSet<ByteString>- Returns:
- The hash code for this attribute.
-
parse
public AttributeParser parse()
Description copied from interface:AttributeReturns a parser for this attribute which can be used for decoding values as different types of object.
-
iterator
public abstract Iterator<ByteString> iterator()
Description copied from interface:AttributeReturns 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 interfaceAttribute- Specified by:
iteratorin interfaceCollection<ByteString>- Specified by:
iteratorin interfaceIterable<ByteString>- Specified by:
iteratorin interfaceSet<ByteString>- Specified by:
iteratorin classAbstractCollection<ByteString>- Returns:
- An iterator over the attribute values in this attribute.
-
matchesApproximateAssertion
public ConditionResult matchesApproximateAssertion(Assertion assertion, ByteSequence rawAssertion)
Description copied from interface:AttributeIndicates whether this attribute matches the specified assertion using the attribute's default approximate matching rule.- Specified by:
matchesApproximateAssertionin interfaceAttribute- Parameters:
assertion- The attribute value assertion compiled using the attribute's default approximate matching rule.rawAssertion- The raw assertion value whose syntax is compatible with the attribute's default approximate matching rule.- Returns:
ConditionResult.FALSEif the assertion does not match any values in this attribute,ConditionResult.TRUEif the assertion matches at least one value in this attribute, orConditionResult.UNDEFINEDif the assertion does not match any values in this attribute, but one or more values could not be compared because they are incompatible with the matching rule.
-
matchesEqualityAssertion
public ConditionResult matchesEqualityAssertion(Assertion assertion, ByteSequence rawAssertion)
Description copied from interface:AttributeIndicates whether this attribute matches the specified assertion using the attribute's default equality matching rule.- Specified by:
matchesEqualityAssertionin interfaceAttribute- Parameters:
assertion- The attribute value assertion compiled using the attribute's default equality matching rule.rawAssertion- The raw assertion value whose syntax is compatible with the attribute's default equality matching rule.- Returns:
ConditionResult.FALSEif the assertion does not match any values in this attribute,ConditionResult.TRUEif the assertion matches at least one value in this attribute, orConditionResult.UNDEFINEDif the assertion does not match any values in this attribute, but one or more values could not be compared because they are incompatible with the matching rule.
-
matchesGreaterOrEqualAssertion
public ConditionResult matchesGreaterOrEqualAssertion(Assertion assertion, ByteSequence rawAssertion)
Description copied from interface:AttributeIndicates whether this attribute matches the specified assertion using the attribute's default ordering matching rule.- Specified by:
matchesGreaterOrEqualAssertionin interfaceAttribute- Parameters:
assertion- The attribute value assertion compiled using the attribute's default ordering matching rule.rawAssertion- The raw assertion value whose syntax is compatible with the attribute's default ordering matching rule.- Returns:
ConditionResult.FALSEif the assertion does not match any values in this attribute,ConditionResult.TRUEif the assertion matches at least one value in this attribute, orConditionResult.UNDEFINEDif the assertion does not match any values in this attribute, but one or more values could not be compared because they are incompatible with the matching rule.
-
matchesLessOrEqualAssertion
public ConditionResult matchesLessOrEqualAssertion(Assertion assertion, ByteSequence rawAssertion)
Description copied from interface:AttributeIndicates whether this attribute matches the specified assertion using the attribute's default ordering matching rule.- Specified by:
matchesLessOrEqualAssertionin interfaceAttribute- Parameters:
assertion- The attribute value assertion compiled using the attribute's default ordering matching rule.rawAssertion- The raw assertion value whose syntax is compatible with the attribute's default ordering matching rule.- Returns:
ConditionResult.FALSEif the assertion does not match any values in this attribute,ConditionResult.TRUEif the assertion matches at least one value in this attribute, orConditionResult.UNDEFINEDif the assertion does not match any values in this attribute, but one or more values could not be compared because they are incompatible with the matching rule.
-
matchesSubstringAssertion
public ConditionResult matchesSubstringAssertion(Assertion assertion, ByteSequence rawInitialSubstring, List<? extends ByteSequence> rawAnySubstrings, ByteSequence rawFinalSubstring)
Description copied from interface:AttributeIndicates whether this attribute matches the specified assertion using the attribute's default ordering matching rule.- Specified by:
matchesSubstringAssertionin interfaceAttribute- Parameters:
assertion- The attribute value assertion compiled using the attribute's default ordering matching rule.rawInitialSubstring- The assertion's initial sub-string, may benullif eitherrawFinalSubstringorrawAnySubstringsare specified.rawAnySubstrings- The assertion's intermediate sub-strings, may be empty if eitherrawFinalSubstringorrawAnySubstringsare specified.rawFinalSubstring- The final sub-string, may benullif eitherrawInitialSubstringorrawAnySubstringsare specified.- Returns:
ConditionResult.FALSEif the assertion does not match any values in this attribute,ConditionResult.TRUEif the assertion matches at least one value in this attribute, orConditionResult.UNDEFINEDif the assertion does not match any values in this attribute, but one or more values could not be compared because they are incompatible with the matching rule.
-
removeAll
public boolean removeAll(Collection<?> values)
Description copied from interface:AttributeRemoves 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 interfaceAttribute- Specified by:
removeAllin interfaceCollection<ByteString>- Specified by:
removeAllin interfaceSet<ByteString>- Overrides:
removeAllin classAbstractSet<ByteString>- Parameters:
values- The attribute values to be removed from this attribute.- Returns:
trueif this attribute changed as a result of this call.
-
removeAll
public <T> boolean removeAll(Collection<T> values, Collection<? super T> missingValues)
Description copied from interface:AttributeRemoves 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.- Specified by:
removeAllin interfaceAttribute- 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.
-
retainAll
public boolean retainAll(Collection<?> values)
Description copied from interface:AttributeRetains 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 interfaceAttribute- Specified by:
retainAllin interfaceCollection<ByteString>- Specified by:
retainAllin interfaceSet<ByteString>- Overrides:
retainAllin classAbstractCollection<ByteString>- Parameters:
values- The attribute values to be retained in this attribute.- Returns:
trueif this attribute changed as a result of this call.
-
retainAll
public <T> boolean retainAll(Collection<T> values, Collection<? super T> missingValues)
Description copied from interface:AttributeRetains 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.- Specified by:
retainAllin interfaceAttribute- 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.
-
isEmpty
public boolean isEmpty()
Description copied from interface:AttributeReturnstrueif this attribute contains no attribute values.- Specified by:
isEmptyin interfaceAttribute- Specified by:
isEmptyin interfaceCollection<ByteString>- Specified by:
isEmptyin interfaceSet<ByteString>- Overrides:
isEmptyin classAbstractCollection<ByteString>- Returns:
trueif this attribute contains no attribute values.
-
size
public int size()
Description copied from interface:AttributeReturns the number of attribute values in this attribute.- Specified by:
sizein interfaceAttribute- Specified by:
sizein interfaceCollection<ByteString>- Specified by:
sizein interfaceSet<ByteString>- Specified by:
sizein classAbstractCollection<ByteString>- Returns:
- The number of attribute values in this attribute.
-
toArray
public ByteString[] toArray()
Description copied from interface:AttributeReturns 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 interfaceAttribute- Specified by:
toArrayin interfaceCollection<ByteString>- Specified by:
toArrayin interfaceSet<ByteString>- Overrides:
toArrayin classAbstractCollection<ByteString>- Returns:
- An array containing all of the attribute values contained in this attribute.
-
toString
public String toString()
Description copied from interface:AttributeReturns a string representation of this attribute.- Specified by:
toStringin interfaceAttribute- Overrides:
toStringin classAbstractCollection<ByteString>- Returns:
- The string representation of this attribute.
-
-