Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 97036 invoked from network); 19 Nov 2006 18:52:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Nov 2006 18:52:52 -0000 Received: (qmail 79021 invoked by uid 500); 19 Nov 2006 18:53:02 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 78965 invoked by uid 500); 19 Nov 2006 18:53:02 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 78954 invoked by uid 99); 19 Nov 2006 18:53:02 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 Nov 2006 10:53:02 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 Nov 2006 10:52:51 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id A0BE11A984A; Sun, 19 Nov 2006 10:52:18 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r476881 - in /directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema: MatchingRuleEnum.java UsageEnum.java Date: Sun, 19 Nov 2006 18:52:18 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061119185218.A0BE11A984A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: elecharny Date: Sun Nov 19 10:52:17 2006 New Revision: 476881 URL: http://svn.apache.org/viewvc?view=rev&rev=476881 Log: Fixed some doco in UsageEnum Moved MatchingRuleEnum to be an enum (java 5) MatchingRuleEnum is never used anywhere ... Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRuleEnum.java directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/UsageEnum.java Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRuleEnum.java URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRuleEnum.java?view=diff&rev=476881&r1=476880&r2=476881 ============================================================================== --- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRuleEnum.java (original) +++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRuleEnum.java Sun Nov 19 10:52:17 2006 @@ -19,14 +19,6 @@ */ package org.apache.directory.shared.ldap.schema; - -import java.util.Map; -import java.util.List; - -import org.apache.directory.shared.ldap.util.EnumUtils; -import org.apache.directory.shared.ldap.util.ValuedEnum; - - /** * Type safe enum for a matching rule's comparator and normalizer component * usage string. This can be take one of the following three values: @@ -37,93 +29,50 @@ * * * @author Apache Directory Project - * @version $Rev$ */ -public class MatchingRuleEnum extends ValuedEnum +public enum MatchingRuleEnum { - static final long serialVersionUID = 5500272648097676014L; - /** value for ordering usage */ - public static final int ORDERING_VAL = 0; + ORDERING( 0 ), /** value for equality usage */ - public static final int EQUALITY_VAL = 1; + EQUALITY( 1 ), /** value for substring usage */ - public static final int SUBSTRING_VAL = 2; - - /** enum for ordering comparator usage */ - public static final MatchingRuleEnum ORDERING = new MatchingRuleEnum( "ORDERING", ORDERING_VAL ); - - /** enum for equality comparator usage */ - public static final MatchingRuleEnum EQUALITY = new MatchingRuleEnum( "EQUALITY", EQUALITY_VAL ); - - /** enum for substring comparator usage */ - public static final MatchingRuleEnum SUBSTRING = new MatchingRuleEnum( "SUBSTRING", SUBSTRING_VAL ); - + SUBSTRING( 2 ); + /** Stores the integer value of each element of the enumeration */ + private int value; + /** * Private constructor so no other instances can be created other than the * public static constants in this class. * - * @param name - * a string name for the enumeration value. * @param value * the integer value of the enumeration. */ - private MatchingRuleEnum(final String name, final int value) - { - super( name, value ); - } - - - /** - * Gets the enumeration type for the usage string regardless of case. - * - * @param usage - * the usage string - * @return the usage enumeration type - */ - public static MatchingRuleEnum getUsage( String usage ) + private MatchingRuleEnum( int value ) { - if ( usage.equalsIgnoreCase( MatchingRuleEnum.EQUALITY.getName() ) ) - { - return MatchingRuleEnum.EQUALITY; - } - - if ( usage.equalsIgnoreCase( MatchingRuleEnum.ORDERING.getName() ) ) - { - return MatchingRuleEnum.ORDERING; - } - - if ( usage.equalsIgnoreCase( MatchingRuleEnum.SUBSTRING.getName() ) ) - { - return MatchingRuleEnum.SUBSTRING; - } - - throw new IllegalArgumentException( "Unknown matching rule usage string" + usage ); + this.value = value; } - + /** - * Gets a List of the enumerations for matching rule usage. - * - * @return the List of enumerations possible for matching rule usage + * @return The value associated with the current element. */ - public static List list() + public int getValue() { - return EnumUtils.getEnumList( MatchingRuleEnum.class ); + return value; } - /** - * Gets the Map of MatchingRuleEnum objects by name using the - * MatchingRuleEnum class. + * Gets the enumeration type for the usage string regardless of case. * - * @return the Map by name of MatchingRuleEnums + * @param matchingRule the usage string + * @return the matchingRule enumeration type */ - public static Map map() + public static MatchingRuleEnum getUsage( String matchingRule ) { - return EnumUtils.getEnumMap( MatchingRuleEnum.class ); + return valueOf( matchingRule ); } } Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/UsageEnum.java URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/UsageEnum.java?view=diff&rev=476881&r1=476880&r2=476881 ============================================================================== --- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/UsageEnum.java (original) +++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/UsageEnum.java Sun Nov 19 10:52:17 2006 @@ -47,29 +47,33 @@ /** value for attributes with dSAOperation usage */ DSA_OPERATION( 3 ); + /** Stores the integer value of each element of the enumeration */ private int value; /** * Private construct so no other instances can be created other than the * public static constants in this class. * - * @param name - * a string name for the enumeration value. - * @param value - * the integer value of the enumeration. + * @param value the integer value of the enumeration. */ private UsageEnum( int value ) { this.value = value; } - + + /** + * @return The value associated with the current element. + */ + public int getValue() + { + return value; + } /** * Gets the enumeration type for the attributeType usage string regardless * of case. * - * @param usage - * the usage string + * @param usage the usage string * @return the usage enumeration type */ public static UsageEnum getUsage( String usage ) @@ -94,14 +98,5 @@ { return null; } - } - - /** - * - * @return The value associated with the current element. - */ - public int getValue() - { - return value; } }