@API(value=MAINTAINED) public class OneOfThemWithComponent extends BaseField implements ComponentWithSingleChild
QueryComponent
that evaluates a nested component against each of the values of a repeated field and is satisfied if any of those are.Constructor and Description |
---|
OneOfThemWithComponent(String fieldName,
Field.OneOfThemEmptyMode emptyMode,
QueryComponent child) |
OneOfThemWithComponent(String fieldName,
QueryComponent child) |
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.
|
QueryComponent |
getChild() |
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 |
withOtherChild(QueryComponent newChild) |
findFieldDescriptor, getFieldName, getFieldValue, getName, requireMessageField, requirePrimitiveField, requireScalarField, validateFieldExistence
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
eval, evalAsync, evalMessageAsync, isAsync, normalizeForPlanner
combineHashes, iterablePlanHash, objectPlanHash, objectsPlanHash, planHash, planHash, planHashUnordered, stringHashUnordered
public OneOfThemWithComponent(@Nonnull String fieldName, @Nonnull QueryComponent child)
public OneOfThemWithComponent(@Nonnull String fieldName, Field.OneOfThemEmptyMode emptyMode, @Nonnull QueryComponent child)
@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 QueryComponent getChild()
getChild
in interface ComponentWithSingleChild
@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 QueryComponent withOtherChild(QueryComponent newChild)
withOtherChild
in interface ComponentWithSingleChild
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)