/** * Evaluate the list of projections backwards, so the first projection that * decides about the inclusion of the field is the last projection specified * in the list. */ @Override public Projection.Inclusion project(Path p, QueryEvaluationContext ctx) { nestedProjector = null; ListIterator<Projector> itemsItr = items.listIterator(items.size()); while (itemsItr.hasPrevious()) { Projector projector = itemsItr.previous(); Projection.Inclusion projectionResult = projector.project(p, ctx); if (projectionResult != Projection.Inclusion.undecided) { nestedProjector = projector.getNestedProjector(); return projectionResult; } } return Projection.Inclusion.undecided; } }
/** * Evaluate the list of projections backwards, so the first projection that * decides about the inclusion of the field is the last projection specified * in the list. */ @Override public Projection.Inclusion project(Path p, QueryEvaluationContext ctx) { nestedProjector = null; ListIterator<Projector> itemsItr = items.listIterator(items.size()); while (itemsItr.hasPrevious()) { Projector projector = itemsItr.previous(); Projection.Inclusion projectionResult = projector.project(p, ctx); if (projectionResult != Projection.Inclusion.undecided) { nestedProjector = projector.getNestedProjector(); return projectionResult; } } return Projection.Inclusion.undecided; } }
@Override public Boolean project(Path p, QueryEvaluationContext ctx) { nestedProjector = null; decidingProjector=null; ListIterator<Projector> itemsItr=items.listIterator(items.size()); while (itemsItr.hasPrevious()) { Projector projector = itemsItr.previous(); Boolean projectionResult = projector.project(p, ctx); if (projectionResult != null) { nestedProjector = projector.getNestedProjector(); decidingProjector = projector.getDecidingProjector(); return projectionResult; } } return null; } }
private static ArrayProjector findArrayProjectorForField(Projector p, Path field) { if (p instanceof ListProjector) { List<Projector> items = ((ListProjector) p).getItems(); ListIterator<Projector> itemsItr = items.listIterator(items.size()); while (itemsItr.hasPrevious()) { Projector projector = itemsItr.previous(); ArrayProjector x = findArrayProjectorForField(projector, field); if (x != null) { return x; } } } else if (p instanceof ArrayProjector) { if (field.matches(((ArrayProjector) p).getArrayFieldPattern())) { return (ArrayProjector) p; } return findArrayProjectorForField(p.getNestedProjector(), field); } return null; } }
private static ArrayProjector findArrayProjectorForField(Projector p, Path field) { if (p instanceof ListProjector) { List<Projector> items = ((ListProjector) p).getItems(); ListIterator<Projector> itemsItr = items.listIterator(items.size()); while (itemsItr.hasPrevious()) { Projector projector = itemsItr.previous(); ArrayProjector x = findArrayProjectorForField(projector, field); if (x != null) { return x; } } } else if (p instanceof ArrayProjector) { if (field.matches(((ArrayProjector) p).getArrayFieldPattern())) { return (ArrayProjector) p; } return findArrayProjectorForField(p.getNestedProjector(), field); } return null; } }
if (result != null) { if (result) { Projector nestedProjector = projector.getNestedProjector(); if (nestedProjector == null) { nestedProjector = projector;
JsonNode newNode; if (cursor.firstChild()) { newNode = (getNestedProjector() == null ? this : getNestedProjector()). project(factory, contextPath, cursor, ctx, fieldNode instanceof ArrayNode); cursor.parent(); LOGGER.debug("Projecting object field {}", cursor.getCurrentPath()); if (cursor.firstChild()) { newNode = (getNestedProjector() == null ? this : getNestedProjector()). project(factory, contextPath, cursor, ctx, false); cursor.parent(); LOGGER.debug("Projecting array field {}", cursor.getCurrentPath()); if (cursor.firstChild()) { newNode = (getNestedProjector() == null ? this : getNestedProjector()). project(factory, contextPath, cursor, ctx, true); cursor.parent();
JsonNode newNode; if (cursor.firstChild()) { newNode = (getNestedProjector() == null ? this : getNestedProjector()). project(factory, contextPath, cursor, ctx, fieldNode instanceof ArrayNode); cursor.parent(); LOGGER.debug("Projecting object field {}", cursor.getCurrentPath()); if (cursor.firstChild()) { newNode = (getNestedProjector() == null ? this : getNestedProjector()). project(factory, contextPath, cursor, ctx, false); cursor.parent(); LOGGER.debug("Projecting array field {}", cursor.getCurrentPath()); if (cursor.firstChild()) { newNode = (getNestedProjector() == null ? this : getNestedProjector()). project(factory, contextPath, cursor, ctx, true); cursor.parent();