final class SortIndex
extends java.lang.Object
myDMO.customerNumber asc, myDMO.customerName asc, myDMO.key descand
myDMO.customerNumber desc, myDMO.customerName desc, myDMO.key asc
All instances of this class are immutable and are stored in a cache which is shared across user contexts.
This information is used in combination with query off-end status, to ensure dynamic queries start their searches at the appropriate record.
OffEnd
,
RecordBuffer.getOffEnd(SortIndex, boolean)
Modifier and Type | Field and Description |
---|---|
private static java.util.Map<java.lang.String,SortIndex> |
cache
Shared cache of all
SortIndex instances |
private java.lang.String |
inverse
Inverse of
phrase , in terms of sort direction |
private java.lang.String |
phrase
A sort index phrase whose leading component is ascending
|
Modifier | Constructor and Description |
---|---|
private |
SortIndex(java.lang.String phrase,
java.lang.String inverse)
Construct a new sort index, specifying a sort phrase and its directional
inverse.
|
Modifier and Type | Method and Description |
---|---|
private static SortIndex |
create(java.lang.String sortPhrase,
RecordBuffer buffer)
Create an instance of this class for the given sort phrase and its
inverse.
|
boolean |
equals(java.lang.Object obj)
Ensure an identity-based equality algorithm is employed when comparing
this object with others.
|
(package private) static SortIndex |
get(java.lang.String sortPhrase,
RecordBuffer buffer)
Get an instance of this class which matches the given sort phrase.
|
int |
hashCode()
Ensure an identity-based hash code is produced for this object.
|
boolean |
isInverseSortPhrase(java.lang.String sort)
Compares the specified sort phrase with the inverse sort phrase of
this
SortIndex . |
private static final java.util.Map<java.lang.String,SortIndex> cache
SortIndex
instancesprivate final java.lang.String phrase
private final java.lang.String inverse
phrase
, in terms of sort directionprivate SortIndex(java.lang.String phrase, java.lang.String inverse)
phrase
- A raw sort index phrase (without upper/rtrim functions).inverse
- Inverse of phrase
, in terms of sort direction.static SortIndex get(java.lang.String sortPhrase, RecordBuffer buffer) throws PersistenceException
sortPhrase
may match either phrase stored in a
SortIndex
instance (i.e., phrase
or
inverse
. If an instance already exists, it is returned
from the shared cache; otherwise, it is created and cached.sortPhrase
- A sort phrase which indicates qualified DMO property name(s)
and the respective direction(s) in which to sort (asc or desc).buffer
- The record buffer associated with the DMO property name(s) to
be sorted.SortIndex
instance.PersistenceException
- if a new instance must be created, and there is an error
parsing sortPhrase
.private static SortIndex create(java.lang.String sortPhrase, RecordBuffer buffer) throws PersistenceException
sortPhrase
- A sort phrase which indicates qualified DMO property name(s)
and the respective direction(s) in which to sort (asc or desc).buffer
- The record buffer associated with the DMO property name(s) to
be sorted.SortIndex
instance.PersistenceException
- if a new instance must be created, and there is an error
parsing sortPhrase
.public final int hashCode()
This is appropriate because each unique instance of this class is immutable and shared. That is, two instances with the same primary sort phrase should never exist in a single JVM instance.
hashCode
in class java.lang.Object
Object.hashCode()
public final boolean equals(java.lang.Object obj)
This is appropriate because each unique instance of this class is immutable and shared. That is, two instances with the same primary sort phrase should never exist in a single JVM instance.
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public boolean isInverseSortPhrase(java.lang.String sort)
SortIndex
.sort
- Sort phrase to compare.true
if the specified sort phase equals the inverse
sort phrase of this SortIndex
.