public abstract class Projection extends JsonObject
| Modifier and Type | Class and Description |
|---|---|
static class |
Projection.Inclusion
Inclusion status for a field
explicit_exclusion: the projection excludes this field explicitly
implicit_exzclusion: the projection excludes this field because an ancestor
of the field is excluded
explicit_inclusion: the projection includes the field explicitly
explicit_exclusion: the projection excludes the field explicitly
undecided: the projection does not decide if the field should be
included/excluded, and does not reference it
|
| Constructor and Description |
|---|
Projection() |
| Modifier and Type | Method and Description |
|---|---|
static Projection |
add(Projection p1,
Projection p2)
Adds two projections and returns a new projection containing both.
|
static Boolean |
fieldAncestorOfPattern(Path field,
Path pattern,
boolean inclusion)
If the field is an ancestor of the pattern, and if
inclusion
is true, returns true. |
static Boolean |
fieldMatchesPattern(Path field,
Path pattern,
boolean inclusion)
Returns whether to include/exclude the field based on whether the field
matches the pattern
|
static Projection |
fromJson(com.fasterxml.jackson.databind.JsonNode node) |
Projection.Inclusion |
getFieldInclusion(Path field)
Determines if the field is included in this projection
|
Projection.Inclusion |
getFieldInclusion(Path field,
Path ctx)
Determine if the field is explicitly included/excluded, implicitly included, or
the projection does not decide on the field.
|
protected static Path |
getNonRelativePath(Path p) |
static Boolean |
impliedInclusion(Path field,
Path pattern,
boolean inclusion)
Returns if the field should be included based on the recursive pattern.
|
static Projection.Inclusion |
isFieldIncluded(Path field,
Path pattern,
boolean inclusion,
boolean recursive)
Returns if the field should be included based on the pattern given.
|
boolean |
isFieldRequiredToEvaluateProjection(Path field)
Returns true if the field is needed to evaluate the projection
|
boolean |
isFieldRequiredToEvaluateProjection(Path field,
Path ctx)
Returns true if the field is needed to evaluate the projection
|
getFactory, getSourceNode, toJson, toStringpublic static Projection fromJson(com.fasterxml.jackson.databind.JsonNode node)
public static Projection add(Projection p1, Projection p2)
public static Boolean fieldMatchesPattern(Path field, Path pattern, boolean inclusion)
field - The field namepattern - The projection patterninclusion - flag to return if the field matches the given patterninclusion if field matches the pattern,
else null
field pattern result
a * true
a a true
a b false
a.b * false
a.b *.b true
a.b a.* true
a.b *.* true
a.b a.b true
The return value is inclusion if result is true,
null if result is false, meaning that whether the field
should be included or not cannot be decided.public static Boolean fieldAncestorOfPattern(Path field, Path pattern, boolean inclusion)
inclusion
is true, returns true. Otherwise, returns null, meaning that whether the
field is included or not cannot be decided.field - The field namepattern - The projection patterninclusion - flag to return if the field matches the given patterninclusion is true, else nullpublic static Boolean impliedInclusion(Path field, Path pattern, boolean inclusion)
field - The field namepattern - The projection patterninclusion - flag to return if the field matches the given patterninclusion if field is in subtree of
pattern else nullpublic static Projection.Inclusion isFieldIncluded(Path field, Path pattern, boolean inclusion, boolean recursive)
field - The field whose inclusion is to be decidedpattern - The field pattern of projectioninclusion - If the projection expression includes the field. If
false, the projection is for exclusionrecursive - If the projection is recursivepublic Projection.Inclusion getFieldInclusion(Path field)
field - The absolute name of the field
If the field name contains array indexes, they are converted to '*'
before evaluation.public Projection.Inclusion getFieldInclusion(Path field, Path ctx)
public boolean isFieldRequiredToEvaluateProjection(Path field)
public boolean isFieldRequiredToEvaluateProjection(Path field, Path ctx)
Copyright © 2015. All rights reserved.