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 extendComparable
- 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
-
-
Constructor Summary
Constructors Constructor Description ComparableComparator(String oid)
The ComparableComparator constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(Comparable<T> o1, Comparable<T> o2)
Compares two objects taking into account that one may be a Comparable.-
Methods inherited from class org.apache.directory.api.ldap.model.schema.LdapComparator
equals, getNormalizer, setSchemaManager, toString
-
Methods inherited from class org.apache.directory.api.ldap.model.schema.LoadableSchemaObject
copy, getBytecode, getFqcn, isValid, setBytecode, setFqcn
-
Methods inherited from class org.apache.directory.api.ldap.model.schema.AbstractSchemaObject
addExtension, addExtension, addName, clear, copy, getDescription, getExtension, getExtensions, getName, getNames, getObjectType, getOid, getSchemaName, getSpecification, hasExtension, hashCode, isDisabled, isEnabled, isObsolete, lock, setDescription, setEnabled, setExtensions, setNames, setNames, setObsolete, setOid, setSchemaName, setSpecification, unlock
-
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Constructor Detail
-
ComparableComparator
public ComparableComparator(String oid)
The ComparableComparator constructor.- Parameters:
oid
- the comparator OID
-
-
Method Detail
-
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:
-
-