Well I didn't get a response to this so I am not sure if its a bug or not.
I installed the new versions:
Spring Roo: 1.1.0.RELEASE
My goal was to change how the converter was converting an object to string.
The default was defined, int ROO_Controller.aj, as:
Code:
Converter<Employee, String> getEmployeeConverter() {
return new Converter<Employee, String>() {
public String convert(Employee employee) {
return new StringBuilder().append(employee.getFirstName()).append(" ").append(employee.getLastName()).append(" ").append(employee.getTelephone()).toString();
}
};
}
Well say I only want the LastName and FirstName and want to change the order so I get something like "LastName, FirstName" and leave off the telelphone.
So like normal, I "Push In" the convert function into the Controller.
Works fine, Roo picks it up and removes it from ROO_Controller.aj.
Unfortunately, as stated above, the call to the function is removed as well from registerConverters.
Well, as stated before, I don't think this is supposed to happen, I didn't change or want anything to change in the registerConverters function. But maybe that's something AspectJ needs in order to do its thing.
So I "Push In" the registerConverters function and add back the call to the employeeConverter.
Now it complains that it can't find the conversionService variable, it's still in the .aj file defined as:
Code:
@Autowired
private GenericConversionService conversionService;
Ok so I "Push In" the conversionService variable.
Roo notices the change and pops up an error.
[FelixDispatchQueue] Field 'conversionService' already defined in target type 'com.iaim.subaru.web.DealerController' (ITD target 'com.iaim.subaru.web.DealerController_Roo_Controll er')
So it seems ROO can't move the conversionService variable from the .aj file to the Java File. Not exactly sure why.
So, again, is this a bug, or am I just doing this wrong? What is the process for adding a Converter, or modifying an existing one, in relation to ROO?
As stated in the documenation Spring Roo Section 9.1:
Converter<Person, String> getPersonConverter() {..}
Creates a better visual representation of Person instances (used to replace the default Roo generated Person.toString() method).
This method can be adjusted if different visual representations of the Person instance are desired.
Well I know can't make the adjustment in the ROO handled .aj file, so what is the process for overriding ROO, so I can make the adjustment, if roo doesn't seem to be handling the "Push In" in this case?
Thanks a lot for any help!!!