use of edu.uci.ics.texera.dataflow.annotation.AdvancedOption in project textdb by TextDB.
the class JsonSchemaHelper method getAdvancedOptionProperties.
public static List<String> getAdvancedOptionProperties(Class<? extends PredicateBase> predicateClass) {
ArrayList<String> advancedProperties = new ArrayList<>();
Constructor<?> constructor = getJsonCreatorConstructor(predicateClass);
for (Annotation[] annotations : Arrays.asList(constructor.getParameterAnnotations())) {
// find the @AdvancedOption annotation for each parameter
Optional<Annotation> findAdvancedOptionAnnotation = Arrays.asList(annotations).stream().filter(annotation -> annotation.annotationType().equals(AdvancedOption.class)).findAny();
if (!findAdvancedOptionAnnotation.isPresent()) {
continue;
}
AdvancedOption advancedOptionAnnotation = (AdvancedOption) findAdvancedOptionAnnotation.get();
// find the @JsonProperty annotation
Optional<Annotation> findJsonProperty = Arrays.asList(annotations).stream().filter(annotation -> annotation.annotationType().equals(JsonProperty.class)).findAny();
if (!findJsonProperty.isPresent()) {
continue;
}
JsonProperty jsonProperty = (JsonProperty) findJsonProperty.get();
if (advancedOptionAnnotation.isAdvancedOption()) {
advancedProperties.add(jsonProperty.value());
}
}
return advancedProperties;
}
Aggregations