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
Compares two objects taking into account that one might be a Comparable.
- Author:
- Apache Directory Project
- See Also:
-
Field Summary
Fields inherited from class LdapComparator
normalizerFields inherited from class AbstractSchemaObject
description, extensions, h, isEnabled, isObsolete, locked, names, objectType, oid, schemaName, specification -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcompare(Comparable<T> o1, Comparable<T> o2) Compares two objects taking into account that one may be a Comparable.Methods inherited from class LdapComparator
equals, getNormalizer, hashCode, setSchemaManager, toStringMethods inherited from class LoadableSchemaObject
copy, getBytecode, getFqcn, isValid, setBytecode, setFqcnMethods inherited from class AbstractSchemaObject
addExtension, addExtension, addName, clear, compareOid, copy, getDescription, getExtension, getExtensions, getName, getNames, getObjectType, getOid, getSchemaName, getSpecification, hasExtension, isDisabled, isEnabled, isObsolete, lock, rehash, rehashBase, setDescription, setEnabled, setExtensions, setNames, setNames, setObsolete, setOid, setSchemaName, setSpecification, unlockMethods inherited from interface Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
ComparableComparator
The ComparableComparator constructor.- Parameters:
oid- the comparator OID
-
-
Method Details
-
compare
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:
-