* virtual properties to the objects being rendered.
*/
private STGroup loadGroup() {
STGroup group = new STGroupFile(getClass().getResource("java.stg"), "UTF8", '<', '>');
// EntityDescription are rendered as the FQN
group.registerRenderer(EntityDescription.class, new AttributeRenderer() {
@Override
public String toString(Object o, String formatString, Locale locale) {
EntityDescription entity = (EntityDescription) o;
if (entity.getTypeName().equals("baseHasUuid")) {
// Swap out for our hand-written base class
return entity.isPersistent() ? BasePersistenceAware.class.getCanonicalName()
: BaseHasUuid.class.getCanonicalName();
}
return packageName + "." + typePrefix + upcase(entity.getTypeName());
}
});
// Types are registered as FQPN
group.registerRenderer(Type.class, new AttributeRenderer() {
@Override
public String toString(Object o, String formatString, Locale locale) {
Type type = (Type) o;
return toString(type);
}