@API(value=MAINTAINED) public class OneOfThemWithComparison extends BaseField implements ComponentWithComparison
QueryComponent
that evaluates a Comparisons.Comparison
against each of the values of a repeated field and is satisfied if any of those are.Constructor and Description |
---|
OneOfThemWithComparison(String fieldName,
Comparisons.Comparison comparison) |
OneOfThemWithComparison(String fieldName,
Field.OneOfThemEmptyMode emptyMode,
Comparisons.Comparison comparison) |
Modifier and Type | Method and Description |
---|---|
ExpressionRef<QueryComponent> |
asNestedWith(NestedContext nestedContext,
ExpressionRef<QueryComponent> thisRef)
Produce an exactly equivalent version of the
PlannerExpression tree rooted at this QueryComponent
as if all operations were nested inside the given NestedContext . |
boolean |
equals(Object o) |
boolean |
equalsWithoutChildren(PlannerExpression otherExpression) |
<M extends Message> |
evalMessage(FDBRecordStoreBase<M> store,
EvaluationContext context,
FDBRecord<M> record,
Message message)
Return whether or not the given record matches this component.
|
Comparisons.Comparison |
getComparison() |
Field.OneOfThemEmptyMode |
getEmptyMode() |
Iterator<? extends ExpressionRef<? extends PlannerExpression>> |
getPlannerExpressionChildren()
Return an iterator of references to the children of this planner expression.
|
protected List<Object> |
getValues(MessageOrBuilder message) |
int |
hashCode() |
int |
planHash()
Return a hash similar to
hashCode , but with the additional guarantee that is is stable across JVMs. |
String |
toString() |
void |
validate(Descriptors.Descriptor descriptor)
Validate that the given descriptor is consistent with this component.
|
protected Descriptors.FieldDescriptor |
validateRepeatedField(Descriptors.Descriptor descriptor) |
QueryComponent |
withOtherComparison(Comparisons.Comparison comparison) |
asUnnestedWith, findFieldDescriptor, getFieldName, getFieldValue, getName, requireMessageField, requirePrimitiveField, requireScalarField, unnestedWith, validateFieldExistence
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getName
asUnnestedWith, eval, evalAsync, evalMessageAsync, isAsync
combineHashes, iterablePlanHash, objectPlanHash, objectsPlanHash, planHash, planHash, planHashUnordered, stringHashUnordered
acceptPropertyVisitor, bindTo
public OneOfThemWithComparison(@Nonnull String fieldName, @Nonnull Comparisons.Comparison comparison)
public OneOfThemWithComparison(@Nonnull String fieldName, Field.OneOfThemEmptyMode emptyMode, @Nonnull Comparisons.Comparison comparison)
@Nullable public <M extends Message> Boolean evalMessage(@Nonnull FDBRecordStoreBase<M> store, @Nonnull EvaluationContext context, @Nullable FDBRecord<M> record, @Nullable Message message)
QueryComponent
evalMessage
.
Under ordinary circumstances, if record
is null
, then message
will be null
.
Otherwise, message
will be record.getRecord()
or some submessage of that, possibly null
if
the corresponding field is missing.evalMessage
in interface QueryComponent
M
- the type of recordstore
- the record store from which the record camecontext
- context for bound expressionsrecord
- the recordmessage
- the Protobuf message to evaluate againstQueryComponent.eval(com.apple.foundationdb.record.provider.foundationdb.FDBRecordStoreBase<M>, com.apple.foundationdb.record.EvaluationContext, com.apple.foundationdb.record.provider.foundationdb.FDBRecord<M>)
public void validate(@Nonnull Descriptors.Descriptor descriptor)
QueryComponent
validate
in interface QueryComponent
descriptor
- a record type descriptor, or a submessage descriptor@Nonnull public Comparisons.Comparison getComparison()
getComparison
in interface ComponentWithComparison
public QueryComponent withOtherComparison(Comparisons.Comparison comparison)
withOtherComparison
in interface ComponentWithComparison
@Nonnull @API(value=EXPERIMENTAL) public Iterator<? extends ExpressionRef<? extends PlannerExpression>> getPlannerExpressionChildren()
PlannerExpression
Collections.emptyIterator()
is returned. The returned iterator should
be treated as an immutable object and may throw an exception if Iterator.remove()
is called.
The iterator must return its elements in a consistent order.getPlannerExpressionChildren
in interface PlannerExpression
@Nullable @API(value=EXPERIMENTAL) public ExpressionRef<QueryComponent> asNestedWith(@Nonnull NestedContext nestedContext, @Nonnull ExpressionRef<QueryComponent> thisRef)
QueryComponent
PlannerExpression
tree rooted at this QueryComponent
as if all operations were nested inside the given NestedContext
. That is, transform all predicates, index
scans, and other operations to the form that they would have if they were nested within the field given by the
parent field of the given nested context. If it is not possible to produce such an expression, return null
.
With QueryComponent.asUnnestedWith(NestedContext, ExpressionRef)
, this method should obey the contract that, for any
expression
and nestedContext
,
expression.asNestedWith(nestedContext, ref).asUnnestedWith(nestedContext, ref)
is either equal to
expression
(according to the equals()
comparison) or null
.
For example, if this component is the predicate field("a").matches(field("b).equals(3))
and the
nestedContext
is built around field("a")
, then this method would return a reference containing
the predicate field("b").equals(3)
.
The thisRef
parameter has two uses. For some implementations of asNestedWith()
, the expression
does not need to be changed, and so it is more efficient to return the containing reference than to build a
new one. Additionally, it is used to generate a reference of the appropriate type using the
ExpressionRef.getNewRefWith(PlannerExpression)
.
asNestedWith
in interface QueryComponent
nestedContext
- a context describing the field to use for nestingthisRef
- the reference that contains this query component@API(value=EXPERIMENTAL) public boolean equalsWithoutChildren(@Nonnull PlannerExpression otherExpression)
equalsWithoutChildren
in interface PlannerExpression
public boolean equals(Object o)
public int hashCode()
public int planHash()
PlanHashable
hashCode
, but with the additional guarantee that is is stable across JVMs.planHash
in interface PlanHashable
@Nonnull public Field.OneOfThemEmptyMode getEmptyMode()
@Nullable protected List<Object> getValues(@Nonnull MessageOrBuilder message)
@Nonnull protected Descriptors.FieldDescriptor validateRepeatedField(@Nonnull Descriptors.Descriptor descriptor)