Author: akarasulu
Date: Wed Oct 6 10:51:43 2004
New Revision: 53887
Modified:
incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultSyntax.java
Log:
formatting/style and added Object overrides
Modified:
incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultSyntax.java
==============================================================================
---
incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultSyntax.java
(original)
+++
incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultSyntax.java
Wed Oct 6 10:51:43 2004
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.ldap.common.schema ;
+package org.apache.ldap.common.schema;
/**
@@ -26,16 +26,16 @@
public class DefaultSyntax implements Syntax
{
/** the oid of this Syntax */
- private final String m_oid ;
- /** the SyntaxChecker used to enforce this Syntax */
- private final SyntaxChecker m_checker ;
+ private final String oid;
+ /** the SyntaxChecker used to enforce this Syntax */
+ private SyntaxChecker checker;
/** the human readible flag */
- private boolean m_isHumanReadible ;
+ private boolean isHumanReadible;
/** a short description of this Syntax */
- private String m_description ;
+ private String description;
/** a human readible identifier for this Syntax */
- private String m_name ;
+ private String name;
// ------------------------------------------------------------------------
@@ -46,13 +46,11 @@
/**
* Creates a Syntax object.
*
- * @param a_oid the OID for this Syntax
- * @param a_checker the SyntaxChecker used to enforce this Syntax
+ * @param oid the OID for this Syntax
*/
- public DefaultSyntax( String a_oid, SyntaxChecker a_checker )
+ public DefaultSyntax( String oid )
{
- m_oid = a_oid ;
- m_checker = a_checker ;
+ this.oid = oid;
}
@@ -64,27 +62,27 @@
/**
* @see org.apache.ldap.common.schema.Syntax#isHumanReadable()
*/
- public boolean isHumanReadable()
+ public final boolean isHumanReadable()
{
- return m_isHumanReadible ;
+ return isHumanReadible;
}
/**
* @see org.apache.ldap.common.schema.Syntax#getDescription()
*/
- public String getDescription()
+ public final String getDescription()
{
- return m_description ;
+ return description;
}
/**
* @see org.apache.ldap.common.schema.Syntax#getName()
*/
- public String getName()
+ public final String getName()
{
- return m_name ;
+ return name;
}
@@ -93,16 +91,16 @@
*/
public final String getOid()
{
- return m_oid ;
+ return oid;
}
/**
* @see org.apache.ldap.common.schema.Syntax#getSyntaxChecker()
*/
- public SyntaxChecker getSyntaxChecker()
+ public final SyntaxChecker getSyntaxChecker()
{
- return m_checker ;
+ return checker;
}
@@ -114,32 +112,93 @@
/**
* Sets the description for this Syntax.
*
- * @param a_description the description to set
+ * @param description the description to set
*/
- protected void setDescription( String a_description )
+ protected void setDescription( String description )
{
- m_description = a_description ;
+ this.description = description;
}
/**
* Sets the human readible flag value.
*
- * @param a_isHumanReadible the human readible flag value to set
+ * @param isHumanReadible the human readible flag value to set
*/
- protected void setHumanReadible( boolean a_isHumanReadible )
+ protected void setHumanReadible( boolean isHumanReadible )
{
- m_isHumanReadible = a_isHumanReadible ;
+ this.isHumanReadible = isHumanReadible;
}
/**
* Sets the name of this Syntax.
- *
- * @param a_name the name to set.
+ *
+ * @param name the name to set.
+ */
+ protected void setName( String name )
+ {
+ this.name = name;
+ }
+
+
+ /**
+ * Sets the name of this Syntax.
+ *
+ * @param syntaxChecker the Syntax checker to use for this Syntax
+ */
+ protected void setSyntaxChecker( SyntaxChecker syntaxChecker )
+ {
+ this.checker = syntaxChecker;
+ }
+
+
+ // ------------------------------------------------------------------------
+ // Object overloads
+ // ------------------------------------------------------------------------
+
+
+ /**
+ * Based on the hashCode of the oid property.
+ *
+ * @return the hashCode of the oid String
+ */
+ public int hashCode()
+ {
+ return oid.hashCode();
+ }
+
+
+ /**
+ * If the object implements Syntax and has the same OID as this Syntax then
+ * they are equal.
+ *
+ * @param obj the object to test for equality
+ * @return true if obj is a Syntax and OID's match
+ */
+ public boolean equals( Object obj )
+ {
+ if ( obj == this )
+ {
+ return true;
+ }
+
+ if ( obj instanceof Syntax )
+ {
+ return oid.equals( ( ( Syntax ) obj ).getOid() );
+ }
+
+ return false;
+ }
+
+
+ /**
+ * Prints out the Syntax OID of the Syntax
+ *
+ * @return
*/
- protected void setName( String a_name )
+ public String toString()
{
- m_name = a_name ;
+ return super.toString();
}
}