@API(value=MAINTAINED) public class NestedField extends BaseNestedField
QueryComponent
that evaluates a nested component against a Message
-valued field.childComponent
Constructor and Description |
---|
NestedField(String fieldName,
QueryComponent childComponent) |
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.
|
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.
|
QueryComponent |
withOtherChild(QueryComponent newChild) |
getChild, isAsync
findFieldDescriptor, getFieldName, getFieldValue, getName, requireMessageField, requirePrimitiveField, requireScalarField, validateFieldExistence
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
eval, evalAsync, evalMessageAsync, normalizeForPlanner
combineHashes, iterablePlanHash, objectPlanHash, objectsPlanHash, planHash, planHash, planHashUnordered, stringHashUnordered
public NestedField(@Nonnull String fieldName, @Nonnull QueryComponent childComponent)
@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.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
descriptor
- a record type descriptor, or a submessage descriptorpublic QueryComponent withOtherChild(QueryComponent newChild)
withOtherChild
in interface ComponentWithSingleChild
withOtherChild
in class BaseNestedField
@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
.
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 int planHash()
PlanHashable
hashCode
, but with the additional guarantee that is is stable across JVMs.planHash
in interface PlanHashable
planHash
in class BaseField