org.apache.directory.api.ldap.model.schema.comparators
Class ComparableComparator<T>
java.lang.Object
org.apache.directory.api.ldap.model.schema.AbstractSchemaObject
org.apache.directory.api.ldap.model.schema.LoadableSchemaObject
org.apache.directory.api.ldap.model.schema.LdapComparator<Comparable<T>>
org.apache.directory.api.ldap.model.schema.comparators.ComparableComparator<T>
- Type Parameters:
T - the type, must extend Comparable
- All Implemented Interfaces:
- Serializable, Comparator<Comparable<T>>, SchemaObject
public class ComparableComparator<T>
- extends LdapComparator<Comparable<T>>
Compares two objects taking into account that one might be a Comparable.
- Author:
- Apache Directory Project
- See Also:
- Serialized Form
| Fields inherited from class org.apache.directory.api.ldap.model.schema.AbstractSchemaObject |
description, extensions, isEnabled, isObsolete, isReadOnly, locked, names, objectType, oid, schemaName, specification |
| Methods inherited from class org.apache.directory.api.ldap.model.schema.AbstractSchemaObject |
addExtension, addExtension, addName, clear, compareOid, copy, getDescription, getExtensions, getName, getNames, getObjectType, getOid, getSchemaName, getSpecification, hashCode, isDisabled, isEnabled, isObsolete, isReadOnly, lock, setDescription, setEnabled, setExtensions, setNames, setNames, setObsolete, setOid, setReadOnly, setSchemaName, setSpecification, unlock |
ComparableComparator
public ComparableComparator(String oid)
- The ComparableComparator constructor.
- Parameters:
oid - the comparator OID
compare
public int compare(Comparable<T> o1,
Comparable<T> o2)
- Compares two objects taking into account that one may be a Comparable. If
the first is a comparable then its compareTo operation is called and the
result returned as is. If the first is not a Comparable but the second is
then its compareTo method is called and the result is returned after
being negated. If none are comparable the hashCode of o1 minus the
hashCode of o2 is returned.
- Parameters:
o1 - the first comparableo2 - the second comparable
- Returns:
Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.