use of spoon.template.Parameter in project spoon by INRIA.
the class Parameters method getParameterName.
private static String getParameterName(Field f) {
String name = f.getName();
Parameter p = f.getAnnotation(Parameter.class);
if ((p != null) && !p.value().equals("")) {
name = p.value();
}
return name;
}
use of spoon.template.Parameter in project spoon by INRIA.
the class Parameters method getParameterField.
public static CtField<?> getParameterField(CtClass<? extends Template<?>> templateClass, String parameterName) {
for (CtTypeMember typeMember : templateClass.getTypeMembers()) {
if (!(typeMember instanceof CtField)) {
continue;
}
CtField<?> f = (CtField<?>) typeMember;
Parameter p = f.getAnnotation(Parameter.class);
if (p == null) {
continue;
}
if (f.getSimpleName().equals(parameterName)) {
return f;
}
if (parameterName.equals(p.value())) {
return f;
}
}
return null;
}
use of spoon.template.Parameter in project spoon by INRIA.
the class Parameters method getParameterName.
private static String getParameterName(CtFieldReference<?> f) {
String name = f.getSimpleName();
Parameter p = f.getDeclaration().getAnnotation(Parameter.class);
if ((p != null) && !p.value().equals("")) {
name = p.value();
}
return name;
}
Aggregations