1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 * 19 */ 20 package org.apache.directory.api.ldap.model.schema; 21 22 23 /** 24 * Type safe enum for a matching rule's comparator and normalizer component 25 * usage string. This can be take one of the following three values: 26 * <ul> 27 * <li>ORDERING</li> 28 * <li>EQUALITY</li> 29 * <li>SUBSTRING</li> 30 * </ul> 31 * 32 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 33 */ 34 public enum MatchingRuleEnum 35 { 36 /** value for ordering usage */ 37 ORDERING(0), 38 39 /** value for equality usage */ 40 EQUALITY(1), 41 42 /** value for substring usage */ 43 SUBSTRING(2); 44 45 /** Stores the integer value of each element of the enumeration */ 46 private int value; 47 48 49 /** 50 * Private constructor so no other instances can be created other than the 51 * public static constants in this class. 52 * 53 * @param value 54 * the integer value of the enumeration. 55 */ 56 private MatchingRuleEnum( int value ) 57 { 58 this.value = value; 59 } 60 61 62 /** 63 * @return The value associated with the current element. 64 */ 65 public int getValue() 66 { 67 return value; 68 } 69 70 71 /** 72 * Gets the enumeration type for the usage string regardless of case. 73 * 74 * @param matchingRule the usage string 75 * @return the matchingRule enumeration type 76 */ 77 public static MatchingRuleEnum getUsage( String matchingRule ) 78 { 79 return valueOf( matchingRule ); 80 } 81 }