本文整理汇总了Java中org.wso2.siddhi.query.api.definition.Attribute.Type方法的典型用法代码示例。如果您正苦于以下问题:Java Attribute.Type方法的具体用法?Java Attribute.Type怎么用?Java Attribute.Type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wso2.siddhi.query.api.definition.Attribute
的用法示例。
在下文中一共展示了Attribute.Type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMaxAggregator
import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
public static OutputAttributeAggregator createMaxAggregator(Attribute.Type[] types) {
if (types.length > 1) {
throw new QueryCreationException("Max can only have one parameter");
}
Attribute.Type type = types[0];
switch (type) {
case STRING:
throw new OperationNotSupportedException("Max not supported for string");
case INT:
return new MaxOutputAttributeAggregatorInt();
case LONG:
return new MaxOutputAttributeAggregatorLong();
case FLOAT:
return new MaxOutputAttributeAggregatorFloat();
case DOUBLE:
return new MaxOutputAttributeAggregatorDouble();
case BOOL:
throw new OperationNotSupportedException("Max not supported for bool");
}
throw new OperationNotSupportedException("Max not supported for " + type);
}
示例2: createSumAggregator
import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
public static OutputAttributeAggregator createSumAggregator(Attribute.Type[] types) {
if (types.length > 1) {
throw new QueryCreationException("Sum can only have one parameter");
}
Attribute.Type type = types[0];
switch (type) {
case STRING:
throw new OperationNotSupportedException("Sum not supported for string");
case INT:
return new SumOutputAttributeAggregatorInt();
case LONG:
return new SumOutputAttributeAggregatorLong();
case FLOAT:
return new SumOutputAttributeAggregatorFloat();
case DOUBLE:
return new SumOutputAttributeAggregatorDouble();
case BOOL:
throw new OperationNotSupportedException("Sum not supported for bool");
}
throw new OperationNotSupportedException("Sum not supported for " + type);
}
示例3: extractAndValidateFeatures
import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
/**
* @param inputDefinition
* @param attributeExpressionExecutors
* @param startIndex starting index
* @param noOfFeatures
* @return
*/
public static List<VariableExpressionExecutor> extractAndValidateFeatures(
AbstractDefinition inputDefinition, ExpressionExecutor[]
attributeExpressionExecutors,
int startIndex, int noOfFeatures) {
List<VariableExpressionExecutor> featureVariableExpressionExecutors = new ArrayList<>();
// feature values start
for (int i = startIndex; i < (startIndex + noOfFeatures); i++) {
if (attributeExpressionExecutors[i] instanceof VariableExpressionExecutor) {
featureVariableExpressionExecutors.add((VariableExpressionExecutor)
attributeExpressionExecutors[i]);
// other attributes should be numeric type.
String attributeName = ((VariableExpressionExecutor)
attributeExpressionExecutors[i]).getAttribute().getName();
Attribute.Type featureAttributeType = inputDefinition.
getAttributeType(attributeName);
//feature attributes not numerical type
if (!isNumeric(featureAttributeType)) {
throw new SiddhiAppValidationException("model.features in " + (i + 1) + "th parameter is not "
+ "a numerical type attribute. Found " + attributeExpressionExecutors[i].getReturnType()
+ ". Check the input stream definition.");
}
} else {
throw new SiddhiAppValidationException((i + 1) + "th parameter is not " +
"an attribute (VariableExpressionExecutor) present in the stream definition. Found a "
+ attributeExpressionExecutors[i].getClass().getCanonicalName());
}
}
return featureVariableExpressionExecutors;
}
示例4: convertToEventArrayForDefaultMapping
import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
private Event[] convertToEventArrayForDefaultMapping(Object eventObject) {
Gson gson = new Gson();
JsonObject[] eventObjects = gson.fromJson(eventObject.toString(), JsonObject[].class);
Event[] events = new Event[eventObjects.length];
int index = 0;
JsonObject eventObj = null;
for (JsonObject jsonEvent : eventObjects) {
if (jsonEvent.has(DEFAULT_JSON_EVENT_IDENTIFIER)) {
eventObj = jsonEvent.get(DEFAULT_JSON_EVENT_IDENTIFIER).getAsJsonObject();
if (failOnMissingAttribute && eventObj.size() < streamAttributes.size()) {
log.error("Json message " + eventObj.toString() + " contains missing attributes. " +
"Hence dropping the message.");
continue;
}
} else {
log.error("Default json message " + eventObj.toString()
+ " in the array does not have the valid event identifier \"event\". " +
"Hence dropping the message.");
continue;
}
Event event = new Event(streamAttributes.size());
Object[] data = event.getData();
int position = 0;
for (Attribute attribute : streamAttributes) {
String attributeName = attribute.getName();
Attribute.Type type = attribute.getType();
String attributeValue = eventObj.get(attributeName).getAsString();
if (attributeValue == null) {
data[position++] = null;
} else {
data[position++] = attributeConverter.getPropertyValue(
attributeValue, type);
}
}
events[index++] = event;
}
return Arrays.copyOfRange(events, 0, index);
}
示例5: registerType
import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
public static void registerType(Class<?> javaType, Attribute.Type siddhiType) {
if (JAVA_TO_SIDDHI_TYPE.containsKey(javaType)) {
throw new IllegalArgumentException("Java type: " + javaType + " or siddhi type: " + siddhiType + " were already registered");
}
JAVA_TO_SIDDHI_TYPE.put(javaType, siddhiType);
SIDDHI_TO_JAVA_TYPE.put(siddhiType, javaType);
}
示例6: registerType
import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
public static void registerType(Class<?> javaType, Attribute.Type siddhiType) {
if (JAVA_TO_SIDDHI_TYPE.containsKey(javaType)) {
throw new IllegalArgumentException("Java type: " + javaType + " or siddhi type: " + siddhiType + " were already registered");
}
JAVA_TO_SIDDHI_TYPE.put(javaType, siddhiType);
SIDDHI_TO_JAVA_TYPE.put(siddhiType, javaType);
}
示例7: setAttributeExpressionExecutors
import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
public void setAttributeExpressionExecutors(List<ExpressionExecutor> attributeExpressionExecutors) {
this.attributeExpressionExecutors = attributeExpressionExecutors;
attributeSize = attributeExpressionExecutors.size();
attributeTypes = new Attribute.Type[attributeExpressionExecutors.size()];
for (int i = 0; i < attributeExpressionExecutors.size(); i++) {
attributeTypes[i] = attributeExpressionExecutors.get(i).getReturnType();
}
}
示例8: isNumeric
import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
public static boolean isNumeric(Attribute.Type attributeType) {
return numericTypes.contains(attributeType);
}
示例9: isLabelType
import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
public static boolean isLabelType(Attribute.Type attributeType) {
return labelTypes.contains(attributeType);
}
示例10: getJavaType
import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
public static Class<?> getJavaType(Attribute.Type attributeType) {
if (!SIDDHI_TO_JAVA_TYPE.containsKey(attributeType)) {
throw new IllegalArgumentException("Unable to get java type for siddhi attribute type: " + attributeType);
}
return SIDDHI_TO_JAVA_TYPE.get(attributeType);
}
示例11: getType
import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
public Attribute.Type getType() {
return type;
}
示例12: createAttributeAggregator
import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
@Override
public OutputAttributeAggregator createAttributeAggregator(Attribute.Type[] types) {
return OutputAttributeHandlerParser.createMinAggregator(types);
}
示例13: createAttributeAggregator
import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
@Override
public OutputAttributeAggregator createAttributeAggregator(Attribute.Type[] types) {
return OutputAttributeHandlerParser.createMaxAggregator(types);
}
示例14: getReturnType
import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
public Attribute.Type getReturnType() {
return Attribute.Type.LONG;
}
示例15: getReturnType
import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
public Attribute.Type getReturnType() {
return type;
}