@Override
public void process(PropertyBean propertyBean, JavaClass javaClass,
JSFGeneratorConfiguration configuration) {
JavaField field = getField(propertyBean, configuration);
JavaMethod accessor = getAccessor(configuration, propertyBean, field);
JavaMethod mutator = getMutator(configuration, propertyBean, field);
if("action".equals(propertyBean.getName())) {
try {
accessor.setMethodBody(new VelocityMethodBody(configuration) {
@Override
public String getTemplate() {
return "snippets/get-action.vm";
}
});
mutator.setMethodBody(new VelocityMethodBody(configuration) {
@Override
public String getTemplate() {
return "snippets/set-action.vm";
}
});
} catch (GeneratorException e) {
e.printStackTrace();
}
} else {
javaClass.addField(field);
}
if (field.getType().getName().equals(MethodBinding.class.getName())) {
for(JavaLanguageElement el : new JavaLanguageElement[] {field, accessor, mutator}) {
el.addAnnotation(SuppressWarnings.class, "\"deprecation\"");
}