Package org.forgerock.opendj.ldap
Class Attributes
java.lang.Object
org.forgerock.opendj.ldap.Attributes
This class contains methods for creating and manipulating attributes.
-
Method Summary
Modifier and TypeMethodDescriptionstatic AttributeemptyAttribute(String attributeDescription) Returns a read-only empty attribute having the specified attribute description.static AttributeemptyAttribute(AttributeDescription attributeDescription) Returns a read-only empty attribute having the specified attribute description.static AttributerenameAttribute(Attribute attribute, String attributeDescription) Returns a view ofattributehaving a different attribute description.static AttributerenameAttribute(Attribute attribute, AttributeDescription attributeDescription) Returns a view ofattributehaving a different attribute description.static AttributesingletonAttribute(String attributeDescription, Object value) Returns a read-only single-valued attribute having the specified attribute description.static AttributesingletonAttribute(AttributeDescription attributeDescription, Object value) Returns a read-only single-valued attribute having the specified attribute description and value.static AttributeunmodifiableAttribute(Attribute attribute) Returns a read-only view ofattribute.
-
Method Details
-
emptyAttribute
Returns a read-only empty attribute having the specified attribute description. Attempts to modify the returned attribute either directly, or indirectly via an iterator, result in anUnsupportedOperationException.- Parameters:
attributeDescription- The attribute description.- Returns:
- The empty attribute.
- Throws:
NullPointerException- IfattributeDescriptionwasnull.
-
emptyAttribute
Returns a read-only empty attribute having the specified attribute description. The attribute description will be decoded using the default schema. Attempts to modify the returned attribute either directly, or indirectly via an iterator, result in anUnsupportedOperationException.- Parameters:
attributeDescription- The attribute description.- Returns:
- The empty attribute.
- Throws:
org.forgerock.i18n.LocalizedIllegalArgumentException- IfattributeDescriptioncould not be decoded using the default schema.NullPointerException- IfattributeDescriptionwasnull.
-
renameAttribute
public static Attribute renameAttribute(Attribute attribute, AttributeDescription attributeDescription) Returns a view ofattributehaving a different attribute description. All operations on the returned attribute "pass-through" to the underlying attribute.- Parameters:
attribute- The attribute to be renamed.attributeDescription- The new attribute description forattribute.- Returns:
- A renamed view of
attribute. - Throws:
NullPointerException- IfattributeorattributeDescriptionwasnull.
-
renameAttribute
Returns a view ofattributehaving a different attribute description. All operations on the returned attribute "pass-through" to the underlying attribute. The attribute description will be decoded using the default schema.- Parameters:
attribute- The attribute to be renamed.attributeDescription- The new attribute description forattribute.- Returns:
- A renamed view of
attribute. - Throws:
org.forgerock.i18n.LocalizedIllegalArgumentException- IfattributeDescriptioncould not be decoded using the default schema.NullPointerException- IfattributeorattributeDescriptionwasnull.
-
singletonAttribute
Returns a read-only single-valued attribute having the specified attribute description and value. Attempts to modify the returned attribute either directly, or indirectly via an iterator, result in anUnsupportedOperationException.If
valueis not an instance ofByteStringthen it will be converted using theByteString.valueOfObject(Object)method.- Parameters:
attributeDescription- The attribute description.value- The single attribute value.- Returns:
- The single-valued attribute.
- Throws:
NullPointerException- IfattributeDescriptionorvaluewasnull.
-
singletonAttribute
Returns a read-only single-valued attribute having the specified attribute description. The attribute description will be decoded using the default schema. Attempts to modify the returned attribute either directly, or indirectly via an iterator, result in anUnsupportedOperationException.If
valueis not an instance ofByteStringthen it will be converted using theByteString.valueOfObject(Object)method.- Parameters:
attributeDescription- The attribute description.value- The single attribute value.- Returns:
- The single-valued attribute.
- Throws:
org.forgerock.i18n.LocalizedIllegalArgumentException- IfattributeDescriptioncould not be decoded using the default schema.NullPointerException- IfattributeDescriptionorvaluewasnull.
-
unmodifiableAttribute
Returns a read-only view ofattribute. Query operations on the returned attribute "read-through" to the underlying attribute, and attempts to modify the returned attribute either directly or indirectly via an iterator result in anUnsupportedOperationException.- Parameters:
attribute- The attribute for which a read-only view is to be returned.- Returns:
- A read-only view of
attribute. - Throws:
NullPointerException- Ifattributewasnull.
-