use of cucumber.api.Transform in project cucumber-jvm by cucumber.
the class ParameterInfo method fromMethod.
public static List<ParameterInfo> fromMethod(Method method) {
List<ParameterInfo> result = new ArrayList<ParameterInfo>();
Type[] genericParameterTypes = method.getGenericParameterTypes();
Annotation[][] annotations = method.getParameterAnnotations();
for (int i = 0; i < genericParameterTypes.length; i++) {
String format = null;
String delimiter = DEFAULT_DELIMITER;
boolean transposed = false;
Transformer<?> transformer = null;
for (Annotation annotation : annotations[i]) {
if (annotation instanceof Format) {
format = ((Format) annotation).value();
} else if (isAnnotatedWith(annotation, Format.class)) {
format = getAnnotationForAnnotation(annotation, Format.class).value();
}
if (annotation instanceof Delimiter) {
delimiter = ((Delimiter) annotation).value();
} else if (isAnnotatedWith(annotation, Delimiter.class)) {
delimiter = getAnnotationForAnnotation(annotation, Delimiter.class).value();
}
if (annotation instanceof Transpose) {
transposed = ((Transpose) annotation).value();
}
if (annotation instanceof Transform) {
transformer = getTransformer(annotation);
} else if (isAnnotatedWith(annotation, Transform.class)) {
transformer = getTransformer(getAnnotationForAnnotation(annotation, Transform.class));
}
}
result.add(new ParameterInfo(genericParameterTypes[i], format, delimiter, transposed, transformer));
}
return result;
}
Aggregations