| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS |
| | | * Portions copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap; |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.schema.Schema; |
| | | import org.forgerock.opendj.ldap.schema.UnknownSchemaElementException; |
| | | import org.forgerock.opendj.ldap.schema.*; |
| | | |
| | | import com.forgerock.opendj.util.ASCIICharProp; |
| | | import com.forgerock.opendj.util.Iterators; |
| | |
| | | * {@code null}. |
| | | */ |
| | | public AttributeDescription withOption(final String option) |
| | | throws NullPointerException |
| | | { |
| | | Validator.ensureNotNull(option); |
| | | |
| | |
| | | * If {@code attributeType} was {@code null}. |
| | | */ |
| | | public static AttributeDescription create(final AttributeType attributeType) |
| | | throws NullPointerException |
| | | { |
| | | Validator.ensureNotNull(attributeType); |
| | | |
| | |
| | | * If {@code attributeType} or {@code option} was {@code null}. |
| | | */ |
| | | public static AttributeDescription create(final AttributeType attributeType, |
| | | final String option) throws NullPointerException |
| | | final String option) |
| | | { |
| | | Validator.ensureNotNull(attributeType, option); |
| | | |
| | |
| | | * If {@code attributeType} or {@code options} was {@code null}. |
| | | */ |
| | | public static AttributeDescription create(final AttributeType attributeType, |
| | | final String... options) throws NullPointerException |
| | | final String... options) |
| | | { |
| | | Validator.ensureNotNull(attributeType, options); |
| | | |
| | |
| | | * If {@code attributeDescription} was {@code null}. |
| | | */ |
| | | public static AttributeDescription valueOf(final String attributeDescription) |
| | | throws UnknownSchemaElementException, LocalizedIllegalArgumentException, |
| | | NullPointerException |
| | | { |
| | | return valueOf(attributeDescription, Schema.getDefaultSchema()); |
| | | } |
| | |
| | | */ |
| | | @SuppressWarnings("serial") |
| | | public static AttributeDescription valueOf(final String attributeDescription, |
| | | final Schema schema) throws UnknownSchemaElementException, |
| | | LocalizedIllegalArgumentException, NullPointerException |
| | | final Schema schema) |
| | | { |
| | | Validator.ensureNotNull(attributeDescription, schema); |
| | | |
| | |
| | | |
| | | |
| | | private static int skipTrailingWhiteSpace(final String attributeDescription, |
| | | int i, final int length) throws LocalizedIllegalArgumentException |
| | | int i, final int length) |
| | | { |
| | | char c; |
| | | while (i < length) |
| | |
| | | // Uncached valueOf implementation. |
| | | private static AttributeDescription valueOf0( |
| | | final String attributeDescription, final Schema schema) |
| | | throws LocalizedIllegalArgumentException |
| | | { |
| | | final boolean allowMalformedNamesAndOptions = schema |
| | | .allowMalformedNamesAndOptions(); |
| | |
| | | * If {@code name} was {@code null}. |
| | | */ |
| | | public int compareTo(final AttributeDescription other) |
| | | throws NullPointerException |
| | | { |
| | | final int result = attributeType.compareTo(other.attributeType); |
| | | if (result != 0) |
| | |
| | | * If {@code option} was {@code null}. |
| | | */ |
| | | public boolean containsOption(final String option) |
| | | throws NullPointerException |
| | | { |
| | | final String normalizedOption = toLowerCase(option); |
| | | return pimpl.containsOption(normalizedOption); |
| | |
| | | * If {@code name} was {@code null}. |
| | | */ |
| | | public boolean isSubTypeOf(final AttributeDescription other) |
| | | throws NullPointerException |
| | | { |
| | | if (!attributeType.isSubTypeOf(other.attributeType)) |
| | | { |
| | |
| | | * If {@code name} was {@code null}. |
| | | */ |
| | | public boolean isSuperTypeOf(final AttributeDescription other) |
| | | throws NullPointerException |
| | | { |
| | | if (!other.attributeType.isSubTypeOf(attributeType)) |
| | | { |