本文整理汇总了Java中org.kitesdk.data.PartitionStrategy.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java PartitionStrategy.Builder方法的具体用法?Java PartitionStrategy.Builder怎么用?Java PartitionStrategy.Builder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kitesdk.data.PartitionStrategy
的用法示例。
在下文中一共展示了PartitionStrategy.Builder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parsePartitionExpression
import org.kitesdk.data.PartitionStrategy; //导入方法依赖的package包/类
private static PartitionStrategy parsePartitionExpression(String expression) {
List<String> expressions = Arrays.asList(expression.split("/"));
ExpressionParser parser = new SpelExpressionParser();
PartitionStrategy.Builder psb = new PartitionStrategy.Builder();
StandardEvaluationContext ctx = new StandardEvaluationContext(psb);
for (String expr : expressions) {
try {
Expression e = parser.parseExpression(expr);
psb = e.getValue(ctx, PartitionStrategy.Builder.class);
}
catch (SpelParseException spe) {
if (!expr.trim().endsWith(")")) {
throw new StoreException("Invalid partitioning expression '" + expr
+ "' - did you forget the closing parenthesis?", spe);
}
else {
throw new StoreException("Invalid partitioning expression '" + expr + "'!", spe);
}
}
catch (SpelEvaluationException see) {
throw new StoreException("Invalid partitioning expression '" + expr + "' - failed evaluation!", see);
}
catch (NullPointerException npe) {
throw new StoreException("Invalid partitioning expression '" + expr + "' - was evaluated to null!", npe);
}
}
return psb.build();
}