use of com.yahoo.elide.datastores.aggregation.annotation.ArgumentDefinition in project elide by yahoo.
the class TableType method getArgumentDefinitions.
private static ArgumentDefinition[] getArgumentDefinitions(List<Argument> arguments) {
int numArguments = arguments == null ? 0 : arguments.size();
ArgumentDefinition[] definitions = new ArgumentDefinition[numArguments];
for (int idx = 0; idx < numArguments; idx++) {
Argument argument = arguments.get(idx);
definitions[idx] = new ArgumentDefinition() {
@Override
public String name() {
return argument.getName();
}
@Override
public String description() {
return argument.getDescription();
}
@Override
public ValueType type() {
return ValueType.valueOf(argument.getType().toUpperCase(Locale.ROOT));
}
@Override
public TableSource tableSource() {
return buildTableSource(argument.getTableSource());
}
@Override
public String[] values() {
return argument.getValues().toArray(new String[0]);
}
@Override
public String defaultValue() {
Object value = argument.getDefaultValue();
return value == null ? null : value.toString();
}
@Override
public Class<? extends Annotation> annotationType() {
return ArgumentDefinition.class;
}
};
}
return definitions;
}
Aggregations