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 java.util.List;
032    import java.util.Map;
033    import java.util.Set;
034    
035    import com.unboundid.util.NotExtensible;
036    import com.unboundid.util.ThreadSafety;
037    import 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 matching rule use defined in the server schema.
044     */
045    @NotExtensible()
046    @ThreadSafety(level=ThreadSafetyLevel.INTERFACE_THREADSAFE)
047    public interface MatchingRuleUse
048    {
049      /**
050       * Retrieves the list of names for this matching rule use, if any.
051       *
052       * @return  The list of names for this matching rule use, or an empty list if
053       *          there are no user-defined names.
054       */
055      List<String> getNames();
056    
057    
058    
059      /**
060       * Indicates whether the provided string is equal to any of the defined names
061       * for this matching rule use.
062       *
063       * @param  name  The name for which to make the determination.
064       *
065       * @return  {@code true} if the provided string matches one of the names for
066       *          this matching rule use, or {@code false} if not.
067       */
068      boolean hasName(final String name);
069    
070    
071    
072      /**
073       * Retrieves the matching rule for this matching rule use.
074       *
075       * @return  The matching rule for this matching rule use.
076       */
077      MatchingRule getMatchingRule();
078    
079    
080    
081      /**
082       * Retrieves the description for this DIT content rule, if any.
083       *
084       * @return  The description for this DIT content rule, or {@code null} if it
085       *          does not have a description.
086       */
087      String getDescription();
088    
089    
090    
091      /**
092       * Retrieves the set of attributes that are associated with this matching rule
093       * use.
094       *
095       * @return  The set of attributes that are associated with this matching rule
096       *          use.
097       */
098      Set<AttributeType> getAttributes();
099    
100    
101    
102      /**
103       * Indicates whether this matching rule use applies to the provided attribute
104       * type.
105       *
106       * @param  t  The attribute type for which to make the determination.
107       *
108       * @return  {@code true} if this matching rule use applies to the provided
109       *          attribute type, or {@code false} if not.
110       */
111      boolean appliesToAttribute(final AttributeType t);
112    
113    
114    
115      /**
116       * Indicates whether this matching rule use is declared obsolete in the server
117       * schema.
118       *
119       * @return  {@code true} if this matching rule use is declared obsolete in the
120       *          server schema, or {@code false} if not.
121       */
122      boolean isObsolete();
123    
124    
125    
126      /**
127       * Retrieves a map of all defined extensions for this matching rule use.
128       *
129       * @return  A map of all defined extensions for this matching rule use.
130       */
131      Map<String,List<String>> getExtensions();
132    
133    
134    
135      /**
136       * Retrieves the name of the schema file in which this matching rule use is
137       * defined.
138       *
139       * @return  The name of the schema file in which this matching rule use is
140       *          defined.
141       */
142      String getSchemaFileName();
143    
144    
145    
146      /**
147       * Indicates whether the provided object is equal to this matching rule use.
148       *
149       * @param  o  The object for which to make the determination.
150       *
151       * @return  {@code true} if the provided object is equal to this matching rule
152       *          use, or {@code false} if not.
153       */
154      boolean equals(final Object o);
155    
156    
157    
158      /**
159       * Retrieves a hash code for this matching rule use.
160       *
161       * @return  A hash code for this matching rule use.
162       */
163      int hashCode();
164    
165    
166    
167      /**
168       * Retrieves a string representation of this matching rule use definition.
169       *
170       * @return  A string representation of this matching rule use definition.
171       */
172      String toString();
173    }