本文整理汇总了Java中com.redhat.lightblue.query.Projection.Inclusion方法的典型用法代码示例。如果您正苦于以下问题:Java Projection.Inclusion方法的具体用法?Java Projection.Inclusion怎么用?Java Projection.Inclusion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.redhat.lightblue.query.Projection
的用法示例。
在下文中一共展示了Projection.Inclusion方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: projectArray
import com.redhat.lightblue.query.Projection; //导入方法依赖的package包/类
@Override
protected Projection.Inclusion projectArray(Path p, QueryEvaluationContext ctx) {
// Is this array element in range?
int index = p.getIndex(p.numSegments() - 1);
if (to == null) {
if (index >= from) {
// This array element is selected.
return isIncluded() ? Projection.Inclusion.explicit_inclusion : Projection.Inclusion.explicit_exclusion;
} else {
return Projection.Inclusion.explicit_exclusion;
}
} else if (to < 0) {
return Projection.Inclusion.explicit_exclusion;
} else if (from <= to && index >= from && index <= to) {
// This array element is selected.
return isIncluded() ? Projection.Inclusion.explicit_inclusion : Projection.Inclusion.explicit_exclusion;
} else {
return Projection.Inclusion.explicit_exclusion;
}
}
示例2: project
import com.redhat.lightblue.query.Projection; //导入方法依赖的package包/类
@Override
public Projection.Inclusion project(Path p, QueryEvaluationContext ctx) {
lastMatch = false;
LOGGER.debug("Evaluating array projection for {}, arrayField={}", p, arrayFieldPattern);
// Is this field pointing to an element of the array
// It is so if 'p' has one more element than 'arrayFieldPattern', and
// if it is a matching descendant
if (p.numSegments() == arrayFieldPattern.numSegments() + 1 && p.matchingDescendant(arrayFieldPattern)) {
Projection.Inclusion ret = projectArray(p, ctx);
LOGGER.debug("Projecting array element {}:{}", p, ret);
lastMatch = ret == Projection.Inclusion.implicit_inclusion || ret == Projection.Inclusion.explicit_inclusion;
return ret;
}
return Projection.Inclusion.undecided;
}
示例3: project
import com.redhat.lightblue.query.Projection; //导入方法依赖的package包/类
@Override
public Projection.Inclusion project(Path p, QueryEvaluationContext ctx) {
if (p.matchingPrefix(field)) {
// If this is true, we're checking an ancestor of the
// projection field, or the projection field itself, but
// not a field that is a descendant of the projection
// field
if (include) {
return Projection.Inclusion.explicit_inclusion;
// Inclusion implies, because if we're going to
// include a descendant of this field, this field
// should also be included
} else if (p.matches(field)) {
return Projection.Inclusion.explicit_exclusion;
// If this field is exclusively excluded, exclude it
}
// Otherwise, this projection does not tell anything about this particular field.
} else if (recursive
&& // If this is a recursive projection
p.numSegments() > field.numSegments()
&& // If we're checking a field deeper than our field
p.prefix(field.numSegments()).matches(field) // And if we're checking a field under the subtree of our field
) {
// This is an implied inclusion or exclusion, because the
// projection is for an ancestor of this field.
return include ? Projection.Inclusion.implicit_inclusion : Projection.Inclusion.implicit_exclusion;
}
return Projection.Inclusion.undecided;
}
示例4: projectArray
import com.redhat.lightblue.query.Projection; //导入方法依赖的package包/类
@Override
protected Projection.Inclusion projectArray(Path p, QueryEvaluationContext ctx) {
LOGGER.debug("Evaluating array query projection for {}", p);
Path contextRoot = ctx.getPath();
QueryEvaluationContext nestedContext = ctx.getNestedContext(contextRoot.isEmpty() ? p
: p.suffix(-contextRoot.numSegments()));
if (query.evaluate(nestedContext)) {
LOGGER.debug("query evaluates to true");
return isIncluded() ? Projection.Inclusion.explicit_inclusion : Projection.Inclusion.explicit_exclusion;
}
return isIncluded() ? Projection.Inclusion.explicit_exclusion : Projection.Inclusion.explicit_inclusion;
}
示例5: project
import com.redhat.lightblue.query.Projection; //导入方法依赖的package包/类
/**
* 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;
}
示例6: isProjected
import com.redhat.lightblue.query.Projection; //导入方法依赖的package包/类
/**
* Returns true if field inclusion is explicit.
*
* @param field the path to check
* @return
*/
private boolean isProjected(Path field) {
LOGGER.debug("Checking if {} is explicitly projected", field);
for (Projection p : projections) {
Projection.Inclusion inc = p.getFieldInclusion(field);
if (inc == Projection.Inclusion.explicit_inclusion) {
LOGGER.debug("{} is explicitly projected by {}", field, p);
return true;
} else {
LOGGER.debug("{} is not projected by {}", field,p);
}
}
return false;
}
示例7: projectArray
import com.redhat.lightblue.query.Projection; //导入方法依赖的package包/类
/**
* Check if the array element matches. This is called after determining that
* the path points to a field that can be interpreted by this projector.
*/
protected abstract Projection.Inclusion projectArray(Path p, QueryEvaluationContext ctx);
示例8: project
import com.redhat.lightblue.query.Projection; //导入方法依赖的package包/类
/**
* Returns true, false, or null if the result cannot be determined.
*
* @param p The absolute field path
* @param ctx Query evaluation context
*/
public abstract Projection.Inclusion project(Path p, QueryEvaluationContext ctx);