本文整理汇总了Java中com.espertech.esper.epl.spec.CreateSchemaDesc.AssignedType方法的典型用法代码示例。如果您正苦于以下问题:Java CreateSchemaDesc.AssignedType方法的具体用法?Java CreateSchemaDesc.AssignedType怎么用?Java CreateSchemaDesc.AssignedType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.espertech.esper.epl.spec.CreateSchemaDesc
的用法示例。
在下文中一共展示了CreateSchemaDesc.AssignedType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isMap
import com.espertech.esper.epl.spec.CreateSchemaDesc; //导入方法依赖的package包/类
public static boolean isMap(Annotation[] annotations, ConfigurationInformation configs, CreateSchemaDesc.AssignedType assignedType) {
// assigned type has priority
if (assignedType == CreateSchemaDesc.AssignedType.OBJECTARRAY) {
return false;
}
if (assignedType == CreateSchemaDesc.AssignedType.MAP) {
return true;
}
if (assignedType == CreateSchemaDesc.AssignedType.VARIANT || assignedType != CreateSchemaDesc.AssignedType.NONE) {
throw new IllegalStateException("Not handled by event representation: " + assignedType);
}
// annotation has second priority
Annotation annotation = AnnotationUtil.findAnnotation(annotations, EventRepresentation.class);
if (annotation != null) {
EventRepresentation eventRepresentation = (EventRepresentation) annotation;
return !eventRepresentation.array();
}
// use engine-wide default
return configs.getEngineDefaults().getEventMeta().getDefaultEventRepresentation() == Configuration.EventRepresentation.MAP;
}
示例2: walkCreateSchema
import com.espertech.esper.epl.spec.CreateSchemaDesc; //导入方法依赖的package包/类
public static CreateSchemaDesc walkCreateSchema(EsperEPL2GrammarParser.CreateSchemaExprContext ctx) throws EPException {
CreateSchemaDesc.AssignedType assignedType = CreateSchemaDesc.AssignedType.NONE;
if (ctx.keyword != null) {
assignedType = CreateSchemaDesc.AssignedType.parseKeyword(ctx.keyword.getText());
}
return getSchemaDesc(ctx.createSchemaDef(), assignedType);
}
示例3: getRepresentation
import com.espertech.esper.epl.spec.CreateSchemaDesc; //导入方法依赖的package包/类
public static EventUnderlyingType getRepresentation(Annotation[] annotations, ConfigurationInformation configs, CreateSchemaDesc.AssignedType assignedType) {
// assigned type has priority
if (assignedType == CreateSchemaDesc.AssignedType.OBJECTARRAY) {
return EventUnderlyingType.OBJECTARRAY;
} else if (assignedType == CreateSchemaDesc.AssignedType.MAP) {
return EventUnderlyingType.MAP;
} else if (assignedType == CreateSchemaDesc.AssignedType.AVRO) {
return EventUnderlyingType.AVRO;
}
if (assignedType == CreateSchemaDesc.AssignedType.VARIANT || assignedType != CreateSchemaDesc.AssignedType.NONE) {
throw new IllegalStateException("Not handled by event representation: " + assignedType);
}
// annotation has second priority
Annotation annotation = AnnotationUtil.findAnnotation(annotations, EventRepresentation.class);
if (annotation != null) {
EventRepresentation eventRepresentation = (EventRepresentation) annotation;
if (eventRepresentation.value() == EventUnderlyingType.AVRO) {
return EventUnderlyingType.AVRO;
} else if (eventRepresentation.value() == EventUnderlyingType.OBJECTARRAY) {
return EventUnderlyingType.OBJECTARRAY;
} else if (eventRepresentation.value() == EventUnderlyingType.MAP) {
return EventUnderlyingType.MAP;
} else {
throw new IllegalStateException("Unrecognized enum " + eventRepresentation.value());
}
}
// use engine-wide default
EventUnderlyingType configured = configs.getEngineDefaults().getEventMeta().getDefaultEventRepresentation();
if (configured == EventUnderlyingType.OBJECTARRAY) {
return EventUnderlyingType.OBJECTARRAY;
} else if (configured == EventUnderlyingType.MAP) {
return EventUnderlyingType.MAP;
} else if (configured == EventUnderlyingType.AVRO) {
return EventUnderlyingType.AVRO;
}
return EventUnderlyingType.MAP;
}
示例4: walkCreateSchema
import com.espertech.esper.epl.spec.CreateSchemaDesc; //导入方法依赖的package包/类
public static CreateSchemaDesc walkCreateSchema(Tree node) throws EPException {
CreateSchemaDesc.AssignedType assignedType = CreateSchemaDesc.AssignedType.NONE;
if (node.getChildCount() > 1) {
String keywordNodeText = node.getChild(1).getText();
assignedType = CreateSchemaDesc.AssignedType.parseKeyword(keywordNodeText);
}
return getSchemaDesc(node.getChild(0), assignedType);
}
示例5: getSchemaDesc
import com.espertech.esper.epl.spec.CreateSchemaDesc; //导入方法依赖的package包/类
private static CreateSchemaDesc getSchemaDesc(EsperEPL2GrammarParser.CreateSchemaDefContext ctx, CreateSchemaDesc.AssignedType assignedType) throws EPException {
String schemaName = ctx.name.getText();
List<ColumnDesc> columnTypes = getColTypeList(ctx.createColumnList());
// get model-after types (could be multiple for variants)
Set<String> typeNames = new LinkedHashSet<String>();
if (ctx.variantList() != null) {
List<EsperEPL2GrammarParser.VariantListElementContext> variantCtxs = ctx.variantList().variantListElement();
for (EsperEPL2GrammarParser.VariantListElementContext variantCtx : variantCtxs) {
typeNames.add(variantCtx.getText());
}
}
// get inherited and start timestamp and end timestamps
String startTimestamp = null;
String endTimestamp = null;
Set<String> inherited = new LinkedHashSet<String>();
Set<String> copyFrom = new LinkedHashSet<String>();
if (ctx.createSchemaQual() != null) {
List<EsperEPL2GrammarParser.CreateSchemaQualContext> qualCtxs = ctx.createSchemaQual();
for (EsperEPL2GrammarParser.CreateSchemaQualContext qualCtx : qualCtxs) {
String qualName = qualCtx.i.getText().toLowerCase(Locale.ENGLISH);
List<String> cols = ASTUtil.getIdentList(qualCtx.columnList());
if (qualName.toLowerCase(Locale.ENGLISH).equals("inherits")) {
inherited.addAll(cols);
continue;
} else if (qualName.toLowerCase(Locale.ENGLISH).equals("starttimestamp")) {
startTimestamp = cols.get(0);
continue;
} else if (qualName.toLowerCase(Locale.ENGLISH).equals("endtimestamp")) {
endTimestamp = cols.get(0);
continue;
} else if (qualName.toLowerCase(Locale.ENGLISH).equals("copyfrom")) {
copyFrom.addAll(cols);
continue;
}
throw new EPException("Expected 'inherits', 'starttimestamp', 'endtimestamp' or 'copyfrom' keyword after create-schema clause but encountered '" + qualName + "'");
}
}
return new CreateSchemaDesc(schemaName, typeNames, columnTypes, inherited, assignedType, startTimestamp, endTimestamp, copyFrom);
}
示例6: getSchemaDesc
import com.espertech.esper.epl.spec.CreateSchemaDesc; //导入方法依赖的package包/类
private static CreateSchemaDesc getSchemaDesc(Tree node, CreateSchemaDesc.AssignedType assignedType) throws EPException {
String schemaName = node.getChild(0).getText();
List<ColumnDesc> columnTypes = getColTypeList(node);
// get model-after types (could be multiple for variants)
Set<String> typeNames = new LinkedHashSet<String>();
for (int i = 0; i < node.getChildCount(); i++) {
if (node.getChild(i).getType() == EsperEPL2Ast.VARIANT_LIST) {
for (int j = 0; j < node.getChild(i).getChildCount(); j++) {
typeNames.add(node.getChild(i).getChild(j).getText());
}
}
}
// get inherited and start timestamp and end timestamps
String startTimestamp = null;
String endTimestamp = null;
Set<String> inherited = new LinkedHashSet<String>();
Set<String> copyFrom = new LinkedHashSet<String>();
for (int i = 0; i < node.getChildCount(); i++) {
Tree p = node.getChild(i);
if (p.getType() == EsperEPL2Ast.CREATE_SCHEMA_EXPR_QUAL) {
String childName = p.getChild(0).getText().toLowerCase();
if (childName.equals("inherits")) {
for (int j = 1; j < p.getChildCount(); j++) {
if (p.getChild(j).getType() == EsperEPL2Ast.EXPRCOL) {
for (int k = 0; k < p.getChild(j).getChildCount(); k++) {
inherited.add(p.getChild(j).getChild(k).getText());
}
}
}
continue;
}
else if (childName.equals("starttimestamp")) {
startTimestamp = p.getChild(1).getChild(0).getText();
continue;
}
else if (childName.equals("endtimestamp")) {
endTimestamp = p.getChild(1).getChild(0).getText();
continue;
}
else if (childName.equals("copyfrom")) {
Tree parent = p.getChild(1);
for (int j = 0; j < parent.getChildCount(); j++) {
copyFrom.add(parent.getChild(j).getText());
}
continue;
}
throw new EPException("Expected 'inherits', 'starttimestamp', 'endtimestamp' or 'copyfrom' keyword after create-schema clause but encountered '" + p.getChild(0).getText() + "'");
}
}
return new CreateSchemaDesc(schemaName, typeNames, columnTypes, inherited, assignedType, startTimestamp, endTimestamp, copyFrom);
}