@API(value=EXPERIMENTAL) public class CollateFunctionKeyExpression extends FunctionKeyExpression implements QueryableKeyExpression
COLLATE
function.
Turns a string into a locale-specific sort key.
The name of the function is determined by the underlying collation rules chosen.
For the Java Platform's own collations, this is collate_jre
.
The function takes the following arguments:
For example,
Key.Expressions.function("collate_jre")is the default locale (from the JVM) and the default (weakest -- ignoring almost all character modifiers) strength.
Key.Expressions.function("collate_jre", Key.Expressions.concat(Key.Expressions.field("text_field"), Key.Expressions.value("fr_CA"), Key.Expressions.value(TextCollator.Strength.SECONDARY)))is case-insensitive, accent-sensitive, Canadian French.
TextCollator
FunctionKeyExpression.BiFunctionBuilder, FunctionKeyExpression.Builder, FunctionKeyExpression.Factory, FunctionKeyExpression.Registry
BaseKeyExpression.IllegalSubKeyException, BaseKeyExpression.UnsplittableKeyExpressionException
KeyExpression.DeserializationException, KeyExpression.FanType, KeyExpression.InvalidExpressionException, KeyExpression.InvalidResultException, KeyExpression.NoSuchArgumentException, KeyExpression.SerializationException
arguments, name
Modifier | Constructor and Description |
---|---|
protected |
CollateFunctionKeyExpression(TextCollatorRegistry collatorRegistry,
String name,
KeyExpression arguments) |
Modifier and Type | Method and Description |
---|---|
boolean |
createsDuplicates()
This states whether the given expression type is capable of evaluating more to more than
one value when applied to a single record.
|
<M extends Message> |
evaluateFunction(FDBRecord<M> record,
Message message,
Key.Evaluated arguments)
The
evaluateFunction method implements the function execution. |
int |
getColumnSize()
Returns the number of items in each KeyValue that will be returned.
|
Function<Object,Object> |
getComparandConversionFunction()
Get a function to be applied to the comparison operand before compairing it with the application of the key expression
to the record.
|
protected static TextCollator |
getInvariableCollator(TextCollatorRegistry collatorRegistry,
KeyExpression arguments) |
int |
getMaxArguments()
Get the maximum number of arguments supported by this function.
|
int |
getMinArguments()
Get the the minimum number of arguments supported by this function.
|
protected TextCollator |
getTextCollator(Key.Evaluated arguments) |
create, equals, equalsAtomic, evaluateMessage, fromProto, getArguments, getChild, getName, hashCode, planHash, toKeyExpression, toProto, toString, validate
getSubKey, getSubKeyImpl, isPrefixKey
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
evalForQuery, getName
evaluate, evaluateMessage, evaluateSingleton, fromProto, getSubKey, hasProperInterfaces, hasRecordTypeKey, isPrefixKey, normalizeKeyForPositions, toKeyExpression, toProto, validate, versionColumns
combineHashes, iterablePlanHash, objectPlanHash, objectsPlanHash, planHash, planHash, planHash, planHashUnordered, stringHashUnordered
getChildren
protected CollateFunctionKeyExpression(@Nonnull TextCollatorRegistry collatorRegistry, @Nonnull String name, @Nonnull KeyExpression arguments)
@Nullable protected static TextCollator getInvariableCollator(@Nonnull TextCollatorRegistry collatorRegistry, @Nonnull KeyExpression arguments)
protected TextCollator getTextCollator(@Nonnull Key.Evaluated arguments)
public int getMinArguments()
FunctionKeyExpression
getMinArguments
in class FunctionKeyExpression
public int getMaxArguments()
FunctionKeyExpression
getMaxArguments
in class FunctionKeyExpression
@Nonnull public <M extends Message> List<Key.Evaluated> evaluateFunction(@Nullable FDBRecord<M> record, @Nullable Message message, @Nonnull Key.Evaluated arguments)
FunctionKeyExpression
evaluateFunction
method implements the function execution. This method is invoked once per
Key.Evaluated
that was produced by the evaluation of the function's argument. Put another way,
the function's argument expression is evaluated and is expected to produce a set of arguments. This method
is invoked once for each of these and, itself, may produce a set of Key.Evaluated
values that
produce the final set of keys.
Note that the record
parameter might be null
. Function implementors should treat
this case the same way that they would treat a non-null
record that has all of its non-repeated
fields unset and all of its repeated fields empty. If the function result depends only on the
value of arguments
and not record
directly, then the implementor can ignore
the nullity of record
.
evaluateFunction
in class FunctionKeyExpression
M
- the type of the recordsrecord
- the record against which this function will produce a keymessage
- the Protobuf message against which this function will produce a keyarguments
- the set of arguments to be applied by the function against the record
public boolean createsDuplicates()
KeyExpression
FanType.FanOut
set (either directly
or indirectly).createsDuplicates
in interface KeyExpression
true
if this expression can evaluate to multiple values and false
otherwisepublic int getColumnSize()
KeyExpression
KeyExpression.FanType.Concatenate
, this will the count of non-nested lists, i.e. this will be value of
evaluate(r).get(i).toList().size() for any i or r.getColumnSize
in interface KeyExpression
@Nullable public Function<Object,Object> getComparandConversionFunction()
QueryableKeyExpression
getComparandConversionFunction
in interface QueryableKeyExpression
null
for no conversion