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-2019 Ping Identity Corporation
026 */
027package com.unboundid.directory.sdk.common.schema;
028
029
030
031import java.util.List;
032import java.util.Map;
033import java.util.Set;
034
035import com.unboundid.util.NotExtensible;
036import com.unboundid.util.ThreadSafety;
037import com.unboundid.util.ThreadSafetyLevel;
038
039
040
041/**
042 * This interface defines a set of methods that may be used to obtain
043 * information about a name form defined in the server schema.
044 */
045@NotExtensible()
046@ThreadSafety(level=ThreadSafetyLevel.INTERFACE_THREADSAFE)
047public interface NameForm
048{
049  /**
050   * Retrieves the numeric OID for this name form.
051   *
052   * @return  The numeric OID for this name form.
053   */
054  String getOID();
055
056
057
058  /**
059   * Retrieves the list of names for this name form, if any.
060   *
061   * @return  The list of names for this name form, or an empty list if
062   *          there are no user-defined names.
063   */
064  List<String> getNames();
065
066
067
068  /**
069   * Retrieves the primary name for this name form, or the numeric OID if no
070   * names are defined.
071   *
072   * @return The primary name or OID for this name form.
073   */
074  String getNameOrOID();
075
076
077
078  /**
079   * Indicates whether the provided string is equal to the OID or any of the
080   * defined names for this name form.
081   *
082   * @param  name  The name for which to make the determination.
083   *
084   * @return  {@code true} if the provided string matches the OID or one of the
085   *          names for this name form, or {@code false} if not.
086   */
087  boolean hasNameOrOID(final String name);
088
089
090
091  /**
092   * Retrieves the description for this name form, if any.
093   *
094   * @return  The description for this name form, or {@code null} if it does not
095   *          have a description.
096   */
097  String getDescription();
098
099
100
101  /**
102   * Retrieves the structural object class for this name form.
103   *
104   * @return  The structural object class for this name form.
105   */
106  ObjectClass getStructuralClass();
107
108
109
110  /**
111   * Retrieves the set of required attributes for this name form.
112   *
113   * @return  The set of required attributes for this name form.
114   */
115  Set<AttributeType> getRequiredAttributes();
116
117
118
119  /**
120   * Indicates whether the provided attribute type is required by this name
121   * form.
122   *
123   * @param  t  The attribute type for which to make the determination.
124   *
125   * @return  {@code true} if the provided attribute type is required by this
126   *          name form, or {@code false} if not.
127   */
128  boolean isRequired(final AttributeType t);
129
130
131
132  /**
133   * Retrieves the set of optional attributes for this name form, if any.
134   *
135   * @return  The set of optional attributes for this name form, or an empty set
136   *          if there are no optional attributes.
137   */
138  Set<AttributeType> getOptionalAttributes();
139
140
141
142  /**
143   * Indicates whether the provided attribute type is optional for this name
144   * form.
145   *
146   * @param  t  The attribute type for which to make the determination.
147   *
148   * @return  {@code true} if the provided attribute type is optional for this
149   *          name form, or {@code false} if not.
150   */
151  boolean isOptional(final AttributeType t);
152
153
154
155  /**
156   * Indicates whether the provided attribute type is allowed for use with this
157   * name form as either a required or optional type.
158   *
159   * @param  t  The attribute type for which to make the determination.
160   *
161   * @return  {@code true} if the provided attribute type is allowed for use
162   *          with this name form, or {@code false} if not.
163   */
164  boolean isRequiredOrOptional(final AttributeType t);
165
166
167
168  /**
169   * Indicates whether this name form is declared obsolete in the server schema.
170   *
171   * @return  {@code true} if this name form is declared obsolete in the server
172   *          schema, or {@code false} if not.
173   */
174  boolean isObsolete();
175
176
177
178  /**
179   * Retrieves a map of all defined extensions for this name form.
180   *
181   * @return  A map of all defined extensions for this name form.
182   */
183  Map<String,List<String>> getExtensions();
184
185
186
187  /**
188   * Retrieves the name of the schema file in which this name form is defined.
189   *
190   * @return  The name of the schema file in which this name form is defined.
191   */
192  String getSchemaFileName();
193
194
195
196  /**
197   * Indicates whether the provided object is equal to this name form.
198   *
199   * @param  o  The object for which to make the determination.
200   *
201   * @return  {@code true} if the provided object is equal to this name form, or
202   *          {@code false} if not.
203   */
204  boolean equals(final Object o);
205
206
207
208  /**
209   * Retrieves a hash code for this name form.
210   *
211   * @return  A hash code for this name form.
212   */
213  int hashCode();
214
215
216
217  /**
218   * Retrieves a string representation of this name form definition.
219   *
220   * @return  A string representation of this name form definition.
221   */
222  String toString();
223}