| | |
| | | |
| | | |
| | | import static com.sun.opends.sdk.messages.Messages.*; |
| | | import static com.sun.opends.sdk.util.StaticUtils.*; |
| | | import static com.sun.opends.sdk.util.StaticUtils.toLowerCase; |
| | | |
| | | import java.util.*; |
| | | |
| | |
| | | import org.opends.sdk.schema.Schema; |
| | | import org.opends.sdk.schema.UnknownSchemaElementException; |
| | | |
| | | import com.sun.opends.sdk.util.*; |
| | | import com.sun.opends.sdk.util.ASCIICharProp; |
| | | import com.sun.opends.sdk.util.Iterators; |
| | | import com.sun.opends.sdk.util.Validator; |
| | | |
| | | |
| | | |
| | | /** |
| | | * An attribute description as defined in RFC 4512 section 2.5. |
| | | * Attribute descriptions are used to identify an attribute in an entry |
| | | * and are composed of an attribute type and a set of zero or more |
| | | * attribute options. |
| | | * An attribute description as defined in RFC 4512 section 2.5. Attribute |
| | | * descriptions are used to identify an attribute in an entry and are composed |
| | | * of an attribute type and a set of zero or more attribute options. |
| | | * |
| | | * @see <a href="http://tools.ietf.org/html/rfc4512#section-2.5">RFC |
| | | * 4512 - Lightweight Directory Access Protocol (LDAP): Directory |
| | | * Information Models </a> |
| | | * @see <a href="http://tools.ietf.org/html/rfc4512#section-2.5">RFC 4512 - |
| | | * Lightweight Directory Access Protocol (LDAP): Directory Information |
| | | * Models </a> |
| | | */ |
| | | public final class AttributeDescription implements |
| | | Comparable<AttributeDescription> |
| | |
| | | |
| | | |
| | | |
| | | private MultiOptionImpl(String[] options, String[] normalizedOptions) |
| | | private MultiOptionImpl(final String[] options, |
| | | final String[] normalizedOptions) |
| | | { |
| | | if (normalizedOptions.length < 2) |
| | | { |
| | |
| | | |
| | | |
| | | @Override |
| | | public int compareTo(Impl other) |
| | | public int compareTo(final Impl other) |
| | | { |
| | | final int thisSize = normalizedOptions.length; |
| | | final int otherSize = other.size(); |
| | |
| | | |
| | | |
| | | @Override |
| | | public boolean containsOption(String normalizedOption) |
| | | public boolean containsOption(final String normalizedOption) |
| | | { |
| | | final int sz = normalizedOptions.length; |
| | | for (int i = 0; i < sz; i++) |
| | |
| | | |
| | | |
| | | @Override |
| | | public boolean equals(Impl other) |
| | | public boolean equals(final Impl other) |
| | | { |
| | | if (other instanceof MultiOptionImpl) |
| | | { |
| | |
| | | |
| | | |
| | | @Override |
| | | public boolean isSubTypeOf(Impl other) |
| | | public boolean isSubTypeOf(final Impl other) |
| | | { |
| | | // Must contain a super-set of other's options. |
| | | if (other == ZERO_OPTION_IMPL) |
| | |
| | | |
| | | |
| | | @Override |
| | | public boolean isSuperTypeOf(Impl other) |
| | | public boolean isSuperTypeOf(final Impl other) |
| | | { |
| | | // Must contain a sub-set of other's options. |
| | | for (final String normalizedOption : normalizedOptions) |
| | |
| | | |
| | | |
| | | |
| | | private SingleOptionImpl(String option, String normalizedOption) |
| | | private SingleOptionImpl(final String option, final String normalizedOption) |
| | | { |
| | | this.option = option; |
| | | this.normalizedOption = normalizedOption; |
| | |
| | | |
| | | |
| | | @Override |
| | | public int compareTo(Impl other) |
| | | public int compareTo(final Impl other) |
| | | { |
| | | if (other == ZERO_OPTION_IMPL) |
| | | { |
| | |
| | | else if (other.size() == 1) |
| | | { |
| | | // Same number of options, so compare. |
| | | return normalizedOption |
| | | .compareTo(other.firstNormalizedOption()); |
| | | return normalizedOption.compareTo(other.firstNormalizedOption()); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | |
| | | @Override |
| | | public boolean containsOption(String normalizedOption) |
| | | public boolean containsOption(final String normalizedOption) |
| | | { |
| | | return this.normalizedOption.equals(normalizedOption); |
| | | } |
| | |
| | | |
| | | |
| | | @Override |
| | | public boolean equals(Impl other) |
| | | public boolean equals(final Impl other) |
| | | { |
| | | return other.size() == 1 |
| | | && other.containsOption(normalizedOption); |
| | | return other.size() == 1 && other.containsOption(normalizedOption); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | @Override |
| | | public boolean isSubTypeOf(Impl other) |
| | | public boolean isSubTypeOf(final Impl other) |
| | | { |
| | | // Other must have no options or the same option. |
| | | if (other == ZERO_OPTION_IMPL) |
| | |
| | | |
| | | |
| | | @Override |
| | | public boolean isSuperTypeOf(Impl other) |
| | | public boolean isSuperTypeOf(final Impl other) |
| | | { |
| | | // Other must have this option. |
| | | return other.containsOption(normalizedOption); |
| | |
| | | |
| | | |
| | | @Override |
| | | public int compareTo(Impl other) |
| | | public int compareTo(final Impl other) |
| | | { |
| | | // If other has options then this sorts before. |
| | | return this == other ? 0 : -1; |
| | |
| | | |
| | | |
| | | @Override |
| | | public boolean containsOption(String normalizedOption) |
| | | public boolean containsOption(final String normalizedOption) |
| | | { |
| | | return false; |
| | | } |
| | |
| | | |
| | | |
| | | @Override |
| | | public boolean equals(Impl other) |
| | | public boolean equals(final Impl other) |
| | | { |
| | | return this == other; |
| | | } |
| | |
| | | |
| | | |
| | | @Override |
| | | public boolean isSubTypeOf(Impl other) |
| | | public boolean isSubTypeOf(final Impl other) |
| | | { |
| | | // Can only be a sub-type if other has no options. |
| | | return this == other; |
| | |
| | | |
| | | |
| | | @Override |
| | | public boolean isSuperTypeOf(Impl other) |
| | | public boolean isSuperTypeOf(final Impl other) |
| | | { |
| | | // Will always be a super-type. |
| | | return true; |
| | |
| | | |
| | | |
| | | |
| | | private static final ThreadLocal<WeakHashMap<Schema, Map<String, AttributeDescription>>> CACHE = new ThreadLocal<WeakHashMap<Schema, Map<String, AttributeDescription>>>() |
| | | private static final ThreadLocal<WeakHashMap< |
| | | Schema, Map<String, AttributeDescription>>> CACHE = |
| | | new ThreadLocal<WeakHashMap<Schema, Map<String, AttributeDescription>>>() |
| | | { |
| | | |
| | | /** |
| | |
| | | { |
| | | final AttributeType attributeType = Schema.getCoreSchema() |
| | | .getAttributeType("2.5.4.0"); |
| | | OBJECT_CLASS = new AttributeDescription(attributeType |
| | | .getNameOrOID(), attributeType, ZERO_OPTION_IMPL); |
| | | OBJECT_CLASS = new AttributeDescription(attributeType.getNameOrOID(), |
| | | attributeType, ZERO_OPTION_IMPL); |
| | | } |
| | | |
| | | // This is the size of the per-thread per-schema attribute description |
| | |
| | | |
| | | |
| | | /** |
| | | * Creates an attribute description having the same attribute type and |
| | | * options as the provided attribute description and, in addition, the |
| | | * provided list of options. |
| | | * Creates an attribute description having the same attribute type and options |
| | | * as the provided attribute description and, in addition, the provided list |
| | | * of options. |
| | | * |
| | | * @param attributeDescription |
| | | * The attribute description. |
| | |
| | | * The attribute options. |
| | | * @return The new attribute description containing {@code options}. |
| | | * @throws NullPointerException |
| | | * If {@code attributeDescription} or {@code options} was |
| | | * {@code null}. |
| | | * If {@code attributeDescription} or {@code options} was {@code |
| | | * null}. |
| | | */ |
| | | public static AttributeDescription create( |
| | | AttributeDescription attributeDescription, String... options) |
| | | final AttributeDescription attributeDescription, final String... options) |
| | | throws NullPointerException |
| | | { |
| | | Validator.ensureNotNull(attributeDescription, options); |
| | |
| | | |
| | | |
| | | /** |
| | | * Creates an attribute description having the same attribute type and |
| | | * options as the provided attribute description and, in addition, the |
| | | * provided new option. |
| | | * Creates an attribute description having the same attribute type and options |
| | | * as the provided attribute description and, in addition, the provided new |
| | | * option. |
| | | * |
| | | * @param attributeDescription |
| | | * The attribute description. |
| | |
| | | * The attribute option. |
| | | * @return The new attribute description containing {@code option}. |
| | | * @throws NullPointerException |
| | | * If {@code attributeDescription} or {@code option} was |
| | | * {@code null}. |
| | | * If {@code attributeDescription} or {@code option} was {@code |
| | | * null}. |
| | | */ |
| | | public static AttributeDescription create( |
| | | AttributeDescription attributeDescription, String option) |
| | | final AttributeDescription attributeDescription, final String option) |
| | | throws NullPointerException |
| | | { |
| | | Validator.ensureNotNull(attributeDescription, option); |
| | |
| | | } |
| | | |
| | | final String oldAttributeDescription = attributeDescription.attributeDescription; |
| | | final StringBuilder builder = new StringBuilder( |
| | | oldAttributeDescription.length() + option.length() + 1); |
| | | final StringBuilder builder = new StringBuilder(oldAttributeDescription |
| | | .length() |
| | | + option.length() + 1); |
| | | builder.append(oldAttributeDescription); |
| | | builder.append(';'); |
| | | builder.append(option); |
| | |
| | | if (impl instanceof ZeroOptionImpl) |
| | | { |
| | | return new AttributeDescription(newAttributeDescription, |
| | | attributeDescription.attributeType, new SingleOptionImpl( |
| | | option, normalizedOption)); |
| | | attributeDescription.attributeType, new SingleOptionImpl(option, |
| | | normalizedOption)); |
| | | |
| | | } |
| | | else if (impl instanceof SingleOptionImpl) |
| | |
| | | } |
| | | |
| | | return new AttributeDescription(newAttributeDescription, |
| | | attributeDescription.attributeType, new MultiOptionImpl( |
| | | newOptions, newNormalizedOptions)); |
| | | attributeDescription.attributeType, new MultiOptionImpl(newOptions, |
| | | newNormalizedOptions)); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | |
| | | return new AttributeDescription(newAttributeDescription, |
| | | attributeDescription.attributeType, new MultiOptionImpl( |
| | | newOptions, newNormalizedOptions)); |
| | | attributeDescription.attributeType, new MultiOptionImpl(newOptions, |
| | | newNormalizedOptions)); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates an attribute description having the provided attribute type |
| | | * and no options. |
| | | * Creates an attribute description having the provided attribute type and no |
| | | * options. |
| | | * |
| | | * @param attributeType |
| | | * The attribute type. |
| | |
| | | * @throws NullPointerException |
| | | * If {@code attributeType} was {@code null}. |
| | | */ |
| | | public static AttributeDescription create(AttributeType attributeType) |
| | | public static AttributeDescription create(final AttributeType attributeType) |
| | | throws NullPointerException |
| | | { |
| | | Validator.ensureNotNull(attributeType); |
| | |
| | | |
| | | |
| | | /** |
| | | * Creates an attribute description having the provided attribute type |
| | | * and single option. |
| | | * Creates an attribute description having the provided attribute type and |
| | | * single option. |
| | | * |
| | | * @param attributeType |
| | | * The attribute type. |
| | |
| | | * The attribute option. |
| | | * @return The attribute description. |
| | | * @throws NullPointerException |
| | | * If {@code attributeType} or {@code option} was {@code |
| | | * null}. |
| | | * If {@code attributeType} or {@code option} was {@code null}. |
| | | */ |
| | | public static AttributeDescription create( |
| | | AttributeType attributeType, String option) |
| | | throws NullPointerException |
| | | public static AttributeDescription create(final AttributeType attributeType, |
| | | final String option) throws NullPointerException |
| | | { |
| | | Validator.ensureNotNull(attributeType, option); |
| | | |
| | |
| | | final String attributeDescription = builder.toString(); |
| | | final String normalizedOption = toLowerCase(option); |
| | | |
| | | return new AttributeDescription(attributeDescription, |
| | | attributeType, new SingleOptionImpl(option, normalizedOption)); |
| | | return new AttributeDescription(attributeDescription, attributeType, |
| | | new SingleOptionImpl(option, normalizedOption)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates an attribute description having the provided attribute type |
| | | * and options. |
| | | * Creates an attribute description having the provided attribute type and |
| | | * options. |
| | | * |
| | | * @param attributeType |
| | | * The attribute type. |
| | |
| | | * The attribute options. |
| | | * @return The attribute description. |
| | | * @throws NullPointerException |
| | | * If {@code attributeType} or {@code options} was {@code |
| | | * null}. |
| | | * If {@code attributeType} or {@code options} was {@code null}. |
| | | */ |
| | | public static AttributeDescription create( |
| | | AttributeType attributeType, String... options) |
| | | throws NullPointerException |
| | | public static AttributeDescription create(final AttributeType attributeType, |
| | | final String... options) throws NullPointerException |
| | | { |
| | | Validator.ensureNotNull(attributeType, options); |
| | | |
| | |
| | | Arrays.sort(normalizedOptions); |
| | | |
| | | final String attributeDescription = builder.toString(); |
| | | return new AttributeDescription(attributeDescription, |
| | | attributeType, new MultiOptionImpl(optionsList, |
| | | normalizedOptions)); |
| | | return new AttributeDescription(attributeDescription, attributeType, |
| | | new MultiOptionImpl(optionsList, normalizedOptions)); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * Returns an attribute description representing the object class |
| | | * attribute type with no options. |
| | | * Returns an attribute description representing the object class attribute |
| | | * type with no options. |
| | | * |
| | | * @return The object class attribute description. |
| | | */ |
| | |
| | | |
| | | |
| | | /** |
| | | * Parses the provided LDAP string representation of an attribute |
| | | * description using the default schema. |
| | | * Parses the provided LDAP string representation of an attribute description |
| | | * using the default schema. |
| | | * |
| | | * @param attributeDescription |
| | | * The LDAP string representation of an attribute |
| | | * description. |
| | | * The LDAP string representation of an attribute description. |
| | | * @return The parsed attribute description. |
| | | * @throws LocalizedIllegalArgumentException |
| | | * If {@code attributeDescription} is not a valid LDAP |
| | | * string representation of an attribute description. |
| | | * If {@code attributeDescription} is not a valid LDAP string |
| | | * representation of an attribute description. |
| | | * @throws NullPointerException |
| | | * If {@code attributeDescription} was {@code null}. |
| | | */ |
| | | public static AttributeDescription valueOf(String attributeDescription) |
| | | public static AttributeDescription valueOf(final String attributeDescription) |
| | | throws LocalizedIllegalArgumentException, NullPointerException |
| | | { |
| | | return valueOf(attributeDescription, Schema.getDefaultSchema()); |
| | |
| | | |
| | | |
| | | /** |
| | | * Parses the provided LDAP string representation of an attribute |
| | | * description using the provided schema. |
| | | * Parses the provided LDAP string representation of an attribute description |
| | | * using the provided schema. |
| | | * |
| | | * @param attributeDescription |
| | | * The LDAP string representation of an attribute |
| | | * description. |
| | | * The LDAP string representation of an attribute description. |
| | | * @param schema |
| | | * The schema to use when parsing the attribute description. |
| | | * @return The parsed attribute description. |
| | | * @throws LocalizedIllegalArgumentException |
| | | * If {@code attributeDescription} is not a valid LDAP |
| | | * string representation of an attribute description. |
| | | * If {@code attributeDescription} is not a valid LDAP string |
| | | * representation of an attribute description. |
| | | * @throws NullPointerException |
| | | * If {@code attributeDescription} or {@code schema} was |
| | | * {@code null}. |
| | | * If {@code attributeDescription} or {@code schema} was {@code |
| | | * null}. |
| | | */ |
| | | @SuppressWarnings("serial") |
| | | public static AttributeDescription valueOf( |
| | | String attributeDescription, Schema schema) |
| | | throws LocalizedIllegalArgumentException, NullPointerException |
| | | public static AttributeDescription valueOf(final String attributeDescription, |
| | | final Schema schema) throws LocalizedIllegalArgumentException, |
| | | NullPointerException |
| | | { |
| | | Validator.ensureNotNull(attributeDescription, schema); |
| | | |
| | |
| | | { |
| | | @Override |
| | | protected boolean removeEldestEntry( |
| | | Map.Entry<String, AttributeDescription> eldest) |
| | | final Map.Entry<String, AttributeDescription> eldest) |
| | | { |
| | | return size() > ATTRIBUTE_DESCRIPTION_CACHE_SIZE; |
| | | } |
| | |
| | | |
| | | |
| | | |
| | | private static int skipTrailingWhiteSpace( |
| | | String attributeDescription, int i, int length) |
| | | throws LocalizedIllegalArgumentException |
| | | private static int skipTrailingWhiteSpace(final String attributeDescription, |
| | | int i, final int length) throws LocalizedIllegalArgumentException |
| | | { |
| | | char c; |
| | | while (i < length) |
| | |
| | | |
| | | // Uncached valueOf implementation. |
| | | private static AttributeDescription valueOf0( |
| | | String attributeDescription, Schema schema) |
| | | final String attributeDescription, final Schema schema) |
| | | throws LocalizedIllegalArgumentException |
| | | { |
| | | int i = 0; |
| | |
| | | } |
| | | else |
| | | { |
| | | oid = attributeDescription.substring(attributeTypeStart, |
| | | attributeTypeEnd); |
| | | oid = attributeDescription |
| | | .substring(attributeTypeStart, attributeTypeEnd); |
| | | } |
| | | |
| | | if (oid.length() == 0) |
| | |
| | | } |
| | | else |
| | | { |
| | | return new AttributeDescription(attributeDescription, |
| | | attributeType, ZERO_OPTION_IMPL); |
| | | return new AttributeDescription(attributeDescription, attributeType, |
| | | ZERO_OPTION_IMPL); |
| | | } |
| | | } |
| | | |
| | |
| | | // only contains a single option. |
| | | if (i == length) |
| | | { |
| | | return new AttributeDescription(attributeDescription, |
| | | attributeType, new SingleOptionImpl(option, normalizedOption)); |
| | | return new AttributeDescription(attributeDescription, attributeType, |
| | | new SingleOptionImpl(option, normalizedOption)); |
| | | } |
| | | |
| | | // Multiple options need sorting and duplicates removed - we could |
| | |
| | | normalizedOptions.add(normalizedOption); |
| | | } |
| | | |
| | | return new AttributeDescription(attributeDescription, |
| | | attributeType, new MultiOptionImpl(options |
| | | .toArray(new String[options.size()]), normalizedOptions |
| | | .toArray(new String[normalizedOptions.size()]))); |
| | | return new AttributeDescription(attributeDescription, attributeType, |
| | | new MultiOptionImpl(options.toArray(new String[options.size()]), |
| | | normalizedOptions.toArray(new String[normalizedOptions.size()]))); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | // Private constructor. |
| | | private AttributeDescription(String attributeDescription, |
| | | AttributeType attributeType, Impl pimpl) |
| | | private AttributeDescription(final String attributeDescription, |
| | | final AttributeType attributeType, final Impl pimpl) |
| | | { |
| | | this.attributeDescription = attributeDescription; |
| | | this.attributeType = attributeType; |
| | |
| | | |
| | | |
| | | /** |
| | | * Compares this attribute description to the provided attribute |
| | | * description. The attribute types are compared first and then, if |
| | | * equal, the options are normalized, sorted, and compared. |
| | | * Compares this attribute description to the provided attribute description. |
| | | * The attribute types are compared first and then, if equal, the options are |
| | | * normalized, sorted, and compared. |
| | | * |
| | | * @param other |
| | | * The attribute description to be compared. |
| | | * @return A negative integer, zero, or a positive integer as this |
| | | * attribute description is less than, equal to, or greater |
| | | * than the specified attribute description. |
| | | * @return A negative integer, zero, or a positive integer as this attribute |
| | | * description is less than, equal to, or greater than the specified |
| | | * attribute description. |
| | | * @throws NullPointerException |
| | | * If {@code name} was {@code null}. |
| | | */ |
| | | public int compareTo(AttributeDescription other) |
| | | public int compareTo(final AttributeDescription other) |
| | | throws NullPointerException |
| | | { |
| | | final int result = attributeType.compareTo(other.attributeType); |
| | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether or not this attribute description contains the |
| | | * provided option. |
| | | * Indicates whether or not this attribute description contains the provided |
| | | * option. |
| | | * |
| | | * @param option |
| | | * The option for which to make the determination. |
| | | * @return {@code true} if this attribute description has the provided |
| | | * option, or {@code false} if not. |
| | | * @return {@code true} if this attribute description has the provided option, |
| | | * or {@code false} if not. |
| | | * @throws NullPointerException |
| | | * If {@code option} was {@code null}. |
| | | */ |
| | | public boolean containsOption(String option) |
| | | public boolean containsOption(final String option) |
| | | throws NullPointerException |
| | | { |
| | | final String normalizedOption = toLowerCase(option); |
| | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether the provided object is an attribute description |
| | | * which is equal to this attribute description. It will be considered |
| | | * equal if the attribute type and normalized sorted list of options |
| | | * are identical. |
| | | * Indicates whether the provided object is an attribute description which is |
| | | * equal to this attribute description. It will be considered equal if the |
| | | * attribute type and normalized sorted list of options are identical. |
| | | * |
| | | * @param o |
| | | * The object for which to make the determination. |
| | | * @return {@code true} if the provided object is an attribute |
| | | * description that is equal to this attribute description, or |
| | | * {@code false} if not. |
| | | * @return {@code true} if the provided object is an attribute description |
| | | * that is equal to this attribute description, or {@code false} if |
| | | * not. |
| | | */ |
| | | @Override |
| | | public boolean equals(Object o) |
| | | public boolean equals(final Object o) |
| | | { |
| | | if (this == o) |
| | | { |
| | |
| | | |
| | | |
| | | /** |
| | | * Returns the attribute type associated with this attribute |
| | | * description. |
| | | * Returns the attribute type associated with this attribute description. |
| | | * |
| | | * @return The attribute type associated with this attribute |
| | | * description. |
| | | * @return The attribute type associated with this attribute description. |
| | | */ |
| | | public AttributeType getAttributeType() |
| | | { |
| | |
| | | |
| | | |
| | | /** |
| | | * Returns an {@code Iterable} containing the options contained in |
| | | * this attribute description. Attempts to remove options using an |
| | | * iterator's {@code remove()} method are not permitted and will |
| | | * result in an {@code UnsupportedOperationException} being thrown. |
| | | * Returns an {@code Iterable} containing the options contained in this |
| | | * attribute description. Attempts to remove options using an iterator's |
| | | * {@code remove()} method are not permitted and will result in an {@code |
| | | * UnsupportedOperationException} being thrown. |
| | | * |
| | | * @return An {@code Iterable} containing the options. |
| | | */ |
| | |
| | | |
| | | |
| | | /** |
| | | * Returns the hash code for this attribute description. It will be |
| | | * calculated as the sum of the hash codes of the attribute type and |
| | | * normalized sorted list of options. |
| | | * Returns the hash code for this attribute description. It will be calculated |
| | | * as the sum of the hash codes of the attribute type and normalized sorted |
| | | * list of options. |
| | | * |
| | | * @return The hash code for this attribute description. |
| | | */ |
| | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether or not this attribute description has any |
| | | * options. |
| | | * Indicates whether or not this attribute description has any options. |
| | | * |
| | | * @return {@code true} if this attribute description has any options, |
| | | * or {@code false} if not. |
| | | * @return {@code true} if this attribute description has any options, or |
| | | * {@code false} if not. |
| | | */ |
| | | public boolean hasOptions() |
| | | { |
| | |
| | | * objectClass} attribute description with no options. |
| | | * |
| | | * @return {@code true} if this attribute description is the {@code |
| | | * objectClass} attribute description with no options, or |
| | | * {@code false} if not. |
| | | * objectClass} attribute description with no options, or {@code |
| | | * false} if not. |
| | | */ |
| | | public boolean isObjectClass() |
| | | { |
| | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether or not this attribute description is a sub-type |
| | | * of the provided attribute description as defined in RFC 4512 |
| | | * section 2.5. Specifically, this method will return {@code true} if |
| | | * and only if the following conditions are both {@code true}: |
| | | * Indicates whether or not this attribute description is a sub-type of the |
| | | * provided attribute description as defined in RFC 4512 section 2.5. |
| | | * Specifically, this method will return {@code true} if and only if the |
| | | * following conditions are both {@code true}: |
| | | * <ul> |
| | | * <li>This attribute description has an attribute type which is equal |
| | | * to, or is a sub-type of, the attribute type in the provided |
| | | * attribute description. |
| | | * <li>This attribute description contains all of the options |
| | | * contained in the provided attribute description. |
| | | * <li>This attribute description has an attribute type which is equal to, or |
| | | * is a sub-type of, the attribute type in the provided attribute description. |
| | | * <li>This attribute description contains all of the options contained in the |
| | | * provided attribute description. |
| | | * </ul> |
| | | * Note that this method will return {@code true} if this attribute |
| | | * description is equal to the provided attribute description. |
| | | * |
| | | * @param other |
| | | * The attribute description for which to make the |
| | | * determination. |
| | | * @return {@code true} if this attribute description is a sub-type of |
| | | * the provided attribute description, or {@code false} if |
| | | * not. |
| | | * The attribute description for which to make the determination. |
| | | * @return {@code true} if this attribute description is a sub-type of the |
| | | * provided attribute description, or {@code false} if not. |
| | | * @throws NullPointerException |
| | | * If {@code name} was {@code null}. |
| | | */ |
| | | public boolean isSubTypeOf(AttributeDescription other) |
| | | public boolean isSubTypeOf(final AttributeDescription other) |
| | | throws NullPointerException |
| | | { |
| | | if (!attributeType.isSubTypeOf(other.attributeType)) |
| | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether or not this attribute description is a super-type |
| | | * of the provided attribute description as defined in RFC 4512 |
| | | * section 2.5. Specifically, this method will return {@code true} if |
| | | * and only if the following conditions are both {@code true}: |
| | | * Indicates whether or not this attribute description is a super-type of the |
| | | * provided attribute description as defined in RFC 4512 section 2.5. |
| | | * Specifically, this method will return {@code true} if and only if the |
| | | * following conditions are both {@code true}: |
| | | * <ul> |
| | | * <li>This attribute description has an attribute type which is equal |
| | | * to, or is a super-type of, the attribute type in the provided |
| | | * attribute description. |
| | | * <li>This attribute description contains a sub-set of the options |
| | | * contained in the provided attribute description. |
| | | * <li>This attribute description has an attribute type which is equal to, or |
| | | * is a super-type of, the attribute type in the provided attribute |
| | | * description. |
| | | * <li>This attribute description contains a sub-set of the options contained |
| | | * in the provided attribute description. |
| | | * </ul> |
| | | * Note that this method will return {@code true} if this attribute |
| | | * description is equal to the provided attribute description. |
| | | * |
| | | * @param other |
| | | * The attribute description for which to make the |
| | | * determination. |
| | | * @return {@code true} if this attribute description is a super-type |
| | | * of the provided attribute description, or {@code false} if |
| | | * not. |
| | | * The attribute description for which to make the determination. |
| | | * @return {@code true} if this attribute description is a super-type of the |
| | | * provided attribute description, or {@code false} if not. |
| | | * @throws NullPointerException |
| | | * If {@code name} was {@code null}. |
| | | */ |
| | | public boolean isSuperTypeOf(AttributeDescription other) |
| | | public boolean isSuperTypeOf(final AttributeDescription other) |
| | | throws NullPointerException |
| | | { |
| | | if (!other.attributeType.isSubTypeOf(attributeType)) |
| | |
| | | |
| | | |
| | | /** |
| | | * Returns the string representation of this attribute description as |
| | | * defined in RFC4512 section 2.5. |
| | | * Returns the string representation of this attribute description as defined |
| | | * in RFC4512 section 2.5. |
| | | * |
| | | * @return The string representation of this attribute description. |
| | | */ |