@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 |
---|---|
boolean |
equals(Object o) |
<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() |
protected List<Object> |
getValues(MessageOrBuilder message) |
int |
hashCode() |
QueryPredicate |
normalizeForPlanner(Source source,
List<String> fieldNamePrefix)
Convert this query component into an equivalent
QueryPredicate by pushing all information about nested
and repeated fields to Element s inside of ElementPredicate s. |
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) |
findFieldDescriptor, getFieldName, getFieldValue, getName, requireMessageField, requirePrimitiveField, requireScalarField, validateFieldExistence
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getName
eval, evalAsync, evalMessageAsync, isAsync, normalizeForPlanner
combineHashes, iterablePlanHash, objectPlanHash, objectsPlanHash, planHash, planHash, planHashUnordered, stringHashUnordered
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 public QueryPredicate normalizeForPlanner(@Nonnull Source source, @Nonnull List<String> fieldNamePrefix)
QueryComponent
QueryPredicate
by pushing all information about nested
and repeated fields to Element
s inside of ElementPredicate
s.
This normalization process requires tracking some state: the name of a nested field is available
only at the relevant NestedField
, but that information is necessary to construct the
ElementPredicate
at the leaves of the sub-tree rooted at
that nested field. This extra information is tracked in the given fieldNamePrefix
.
normalizeForPlanner
in interface QueryComponent
source
- the source representing the input stream of the key expressionfieldNamePrefix
- the (non-repeated) field names on the path from the most recent source to this part of the query componentpublic 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)