本文整理了Java中org.wso2.siddhi.query.api.annotation.Annotation.getAnnotations()
方法的一些代码示例,展示了Annotation.getAnnotations()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Annotation.getAnnotations()
方法的具体详情如下:
包路径:org.wso2.siddhi.query.api.annotation.Annotation
类名称:Annotation
方法名:getAnnotations
暂无
代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.sp.jobmanager.core
/**
* Provide the parallelism count for pass-through query. In case of multiple user given values,
* lowest one will be selected. Default parallelism value would be 1.
*
* @param annotation Source annotation
* @return Parallelism count for pass-through query
*/
private int getSourceParallelism(Annotation annotation) {
Set<Integer> parallelismSet = new HashSet<>();
List<Annotation> distAnnotations = annotation.getAnnotations(
SiddhiTopologyCreatorConstants.DISTRIBUTED_IDENTIFIER);
if (distAnnotations.size() > 0) {
for (Annotation distAnnotation : distAnnotations) {
if (distAnnotation.getElement(SiddhiTopologyCreatorConstants.PARALLEL_IDENTIFIER) != null) {
parallelismSet.add(Integer.valueOf(distAnnotation.getElement(
SiddhiTopologyCreatorConstants.PARALLEL_IDENTIFIER)));
} else {
return SiddhiTopologyCreatorConstants.DEFAULT_PARALLEL;
}
}
} else {
return SiddhiTopologyCreatorConstants.DEFAULT_PARALLEL;
}
return parallelismSet.stream().min(Comparator.comparing(Integer::intValue)).get();
}
}
代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.siddhi.editor.core
/**
* Generates AnnotationConfig String for the given Siddhi Annotation
* @param annotation Siddhi Annotation
* @return String representing the Annotation
*/
public String generateAnnotationConfig(Annotation annotation) {
StringBuilder annotationConfig = new StringBuilder();
annotationConfig.append("@");
annotationConfig.append(annotation.getName());
annotationConfig.append("(");
List<String> annotationMembers = new ArrayList<>();
for (Element element : annotation.getElements()) {
annotationMembers.add(element.toString());
}
for (Annotation innerAnnotation : annotation.getAnnotations()) {
annotationMembers.add(generateAnnotationConfig(innerAnnotation));
}
annotationConfig.append(String.join(", ", annotationMembers));
annotationConfig.append(")");
preserveCodeSegment(annotation);
return annotationConfig.toString();
}
代码示例来源:origin: org.wso2.extension.siddhi.io.file/siddhi-io-file
protected void init(StreamDefinition streamDefinition, OptionHolder optionHolder,
ConfigReader configReader, SiddhiAppContext siddhiAppContext) {
this.siddhiAppContext = siddhiAppContext;
uriOption = optionHolder.validateAndGetOption(Constants.FILE_URI);
String append = optionHolder.validateAndGetStaticValue(Constants.APPEND, Constants.TRUE);
properties = new HashMap<>();
properties.put(Constants.ACTION, Constants.WRITE);
if (Constants.TRUE.equalsIgnoreCase(append)) {
properties.put(Constants.APPEND, append);
}
String mapType = streamDefinition.getAnnotations().get(0).getAnnotations().get(0).getElements().get(0)
.getValue();
addEventSeparator = optionHolder.isOptionExists(Constants.ADD_EVENT_SEPARATOR) ?
Boolean.parseBoolean(optionHolder.validateAndGetStaticValue(Constants.ADD_EVENT_SEPARATOR)) :
!mapType.equalsIgnoreCase("csv");
}
代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.siddhi.editor.core
/**
* Generates config for a Mapper
* @param mapAnnotation Siddhi annotation that contains details of a Siddhi Mapper
* @return MapperConfig object
* @throws DesignGenerationException Error while generating MapperConfig
*/
private MapperConfig generateMapperConfig(Annotation mapAnnotation) throws DesignGenerationException {
String type = null;
List<String> options = new ArrayList<>();
for (Element element : mapAnnotation.getElements()) {
if (element.getKey().equalsIgnoreCase(TYPE)) {
type = element.getValue();
} else {
options.add(element.toString());
}
}
if (type == null) {
throw new DesignGenerationException("Unable to find 'type' of the mapper");
}
MapperPayloadOrAttribute payloadOrAttribute = null;
if (!mapAnnotation.getAnnotations().isEmpty()) {
payloadOrAttribute = generateMapperPayloadOrAttributes(mapAnnotation.getAnnotations().get(0));
}
MapperConfig mapperConfig = new MapperConfig(type, options, payloadOrAttribute);
preserveAndBindCodeSegment(mapAnnotation, mapperConfig);
return mapperConfig;
}
代码示例来源:origin: org.wso2.extension.siddhi.io.http/siddhi-io-http
/**
* The initialization method for {@link Sink}, which will be called before other methods and validate
* the all configuration and getting the intial values.
*
* @param outputStreamDefinition containing stream definition bind to the {@link Sink}
* @param optionHolder Option holder containing static and dynamic configuration related
* to the {@link Sink}
* @param configReader to read the sink related system configuration.
* @param siddhiAppContext the context of the {@link org.wso2.siddhi.query.api.SiddhiApp} used to
* get siddhi related utilty functions.
*/
@Override
protected void init(StreamDefinition outputStreamDefinition, OptionHolder optionHolder,
ConfigReader configReader, SiddhiAppContext siddhiAppContext) {
//read configurations
this.messageIdOption = optionHolder.validateAndGetOption(HttpConstants.MESSAGE_ID);
this.sourceId = optionHolder.validateAndGetStaticValue(HttpConstants.SOURCE_ID);
this.httpHeaderOption = optionHolder.getOrCreateOption(HttpConstants.HEADERS, HttpConstants.DEFAULT_HEADER);
this.mapType = outputStreamDefinition.getAnnotations().get(0).getAnnotations().get(0).getElements().get(0)
.getValue();
}
代码示例来源:origin: org.wso2.extension.siddhi.map.text/siddhi-map-text
for (Element el : streamDefinition.getAnnotations().get(0).getAnnotations().get(0).getElements()) {
if (el.getKey().contains(REGULAR_EXPRESSION_GROUP)) {
regexGroupMap.put(el.getKey()
代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.siddhi.editor.core
for (Annotation sourceOrSinkAnnotation : sourceOrSinkAndConnectedElement.getKey().getAnnotations()) {
if (MAP.equalsIgnoreCase(sourceOrSinkAnnotation.getName())) {
map = generateMapperConfig(sourceOrSinkAnnotation);
代码示例来源:origin: org.wso2.extension.siddhi.io.http/siddhi-io-http
this.siddhiAppContext = siddhiAppContext;
this.streamID = siddhiAppContext.getName() + PORT_HOST_SEPARATOR + outputStreamDefinition.toString();
this.mapType = outputStreamDefinition.getAnnotations().get(0).getAnnotations().get(0).getElements().get(0)
.getValue();
this.publisherURLOption = optionHolder.validateAndGetOption(HttpConstants.PUBLISHER_URL);
内容来源于网络,如有侵权,请联系作者删除!