001 /*
002 * CDDL HEADER START
003 *
004 * The contents of this file are subject to the terms of the
005 * Common Development and Distribution License, Version 1.0 only
006 * (the "License"). You may not use this file except in compliance
007 * with the License.
008 *
009 * You can obtain a copy of the license at
010 * docs/licenses/cddl.txt
011 * or http://www.opensource.org/licenses/cddl1.php.
012 * See the License for the specific language governing permissions
013 * and limitations under the License.
014 *
015 * When distributing Covered Code, include this CDDL HEADER in each
016 * file and include the License file at
017 * docs/licenses/cddl.txt. If applicable,
018 * add the following below this CDDL HEADER, with the fields enclosed
019 * by brackets "[]" replaced with your own identifying information:
020 * Portions Copyright [yyyy] [name of copyright owner]
021 *
022 * CDDL HEADER END
023 *
024 *
025 * Copyright 2010-2012 UnboundID Corp.
026 */
027 package com.unboundid.directory.sdk.common.schema;
028
029
030
031 import com.unboundid.util.ByteString;
032 import com.unboundid.util.NotExtensible;
033 import com.unboundid.util.ThreadSafety;
034 import com.unboundid.util.ThreadSafetyLevel;
035
036
037
038 /**
039 * This interface provides an API for interacting with attribute syntaxes, which
040 * can be used to constrain the kinds of data that may be stored in associated
041 * attributes.
042 */
043 @NotExtensible()
044 @ThreadSafety(level=ThreadSafetyLevel.INTERFACE_THREADSAFE)
045 public interface AttributeSyntax
046 {
047 /**
048 * Retrieves the numeric OID for this attribute syntax.
049 *
050 * @return The numeric OID for this attribute syntax.
051 */
052 String getOID();
053
054
055
056 /**
057 * Retrieves the name for this attribute syntax, if any.
058 *
059 * @return The name for this attribute syntax, or {@code null} if it does not
060 * have a name.
061 */
062 String getName();
063
064
065
066 /**
067 * Retrieves the name for this attribute syntax, or the numeric OID if it does
068 * not have a name.
069 *
070 * @return The name for this attribute syntax, or the numeric OID if it does
071 * not have a name.
072 */
073 String getNameOrOID();
074
075
076
077 /**
078 * Indicates whether the provided string matches the name or numeric OID for
079 * this attribute syntax.
080 *
081 * @param name The name for which to make the determination.
082 *
083 * @return {@code true} if the provided string matches the name or numeric
084 * OID for this attribute syntax, or {@code false} if not.
085 */
086 boolean hasNameOrOID(final String name);
087
088
089
090 /**
091 * Retrieves the description for this attribute syntax, if any.
092 *
093 * @return The description for this attribute syntax, or {@code null} if it
094 * does not have a description.
095 */
096 String getDescription();
097
098
099
100 /**
101 * Retrieves the default equality matching rule that will be used for
102 * attribute types with this syntax which do not explicitly specify their own
103 * equality matching rule.
104 *
105 * @return The default equality matching rule that will be used for attribute
106 * types with this syntax, or {@code null} if there is no default
107 * equality matching rule.
108 */
109 EqualityMatchingRule getDefaultEqualityMatchingRule();
110
111
112
113 /**
114 * Retrieves the default ordering matching rule that will be used for
115 * attribute types with this syntax which do not explicitly specify their own
116 * ordering matching rule.
117 *
118 * @return The default ordering matching rule that will be used for attribute
119 * types with this syntax, or {@code null} if there is no default
120 * ordering matching rule.
121 */
122 OrderingMatchingRule getDefaultOrderingMatchingRule();
123
124
125
126 /**
127 * Retrieves the default substring matching rule that will be used for
128 * attribute types with this syntax which do not explicitly specify their own
129 * substring matching rule.
130 *
131 * @return The default substring matching rule that will be used for
132 * attribute types with this syntax, or {@code null} if there is no
133 * default substring matching rule.
134 */
135 SubstringMatchingRule getDefaultSubstringMatchingRule();
136
137
138
139 /**
140 * Retrieves the default approximate matching rule that will be used for
141 * attribute types with this syntax which do not explicitly specify their own
142 * approximate matching rule.
143 *
144 * @return The default approximate matching rule that will be used for
145 * attribute types with this syntax, or {@code null} if there is no
146 * default approximate matching rule.
147 */
148 ApproximateMatchingRule getDefaultApproximateMatchingRule();
149
150
151
152 /**
153 * Indicates whether the provided value is acceptable for use with this
154 * attribute syntax.
155 *
156 * @param value The value for which to make the determination.
157 * @param invalidReason A buffer to which a message may be appended with
158 * information about why the given value is not
159 * acceptable.
160 *
161 * @return {@code true} if the provided value is acceptable for use with this
162 * attribute syntax, or {@code false} if not.
163 */
164 boolean valueIsAcceptable(final ByteString value,
165 final StringBuilder invalidReason);
166
167
168
169 /**
170 * Retrieves the hash code for this attribute syntax.
171 *
172 * @return The hash code for this attribute syntax.
173 */
174 int hashCode();
175
176
177
178 /**
179 * Indicates whether the provided object is equal to this attribute syntax.
180 *
181 * @param o The object for which to make the determination.
182 *
183 * @return {@code true} if the provided object is equal to this attribute
184 * syntax, or {@code false} if not.
185 */
186 boolean equals(final Object o);
187
188
189
190 /**
191 * Retrieves a string representation of this attribute syntax.
192 *
193 * @return A string representation of this attribute syntax.
194 */
195 String toString();
196 }