final class ParameterIndices
extends java.lang.Object
A query object will have the original array of parameters provided by
business logic, as well as an instance of HQLPreprocessor
. That
instance will provide an instance of this class via its HQLPreprocessor.getParameterIndices()
method. To obtain the correct list
of parameters which corresponds with the preprocessed where clause, the
query iterates its original array of parameters. For each index in that
array, it calls getIndex(int)
to obtain the remapped position of
the parameter originally at the current index. If null
is
returned, it means the parameter originally at the current index has been
inlined into the where clause. A non-null
value represents
the zero-based index at which the parameter can be found in the original
array.
Modifier and Type | Field and Description |
---|---|
private int |
count
Count of substitution parameters in use
|
private java.lang.Integer[] |
indices
Mapping of indices of parameters in original array
|
Constructor and Description |
---|
ParameterIndices(java.lang.Integer[] indices)
Constructor which sets the array of new index positions of query
substitution parameters for the associated where clause.
|
Modifier and Type | Method and Description |
---|---|
(package private) int |
getCount()
Get the count of query substitution parameters which survived the where
clause preprocessing step.
|
(package private) java.lang.Integer |
getIndex(int position)
Given a position of a query substitution parameter in the original array
of parameters (before the where clause preprocessing step), get the new,
zero-based index of that parameter in the original array.
|
private final int count
private final java.lang.Integer[] indices
ParameterIndices(java.lang.Integer[] indices)
indices
- Array of zero-based index positions of query substitution
parameters in the original array of parameters. If
null
, the associated query string has no query
substitution parameters.int getCount()
null
index positions in the array of indices passed to this object's
constructor.java.lang.Integer getIndex(int position)
position
supplied, this indicates the parameter's placeholder (?
) is
located at the same relative position in the where clause as before
preprocessing.position
- Zero-based index of the target substitution parameter in the
original array.null
if the parameter was
inlined during preprocessing of the where clause.