# JTypeBuilder and APT

I’ve just replaced the old parser based approach too JTypeBuilder with an annotation processing tool. It’s currently very sketchy, but the code it produces now compiles, which is enough for me for the moment. :-)

Basically the idea is that you have an abstract class that looks something like the following:

@TypebuilderTarget
public abstract class Test
{
public abstract String getFoo();
public abstract Badger getMushroom();
}


The type builder then extends this with the skeleton, filling in the implementations.

Next steps include tidying it up (it needs that really really badly. The code that’s curently there is basically just what I hacked together while figuring out APT), figuring out how to hook this up into the autodiscovery feature of annotation processing tools, and improving it so it only overrides equals, hashCode and toString if you declare them abstract. After that I have a bunch more annotations I intend to add in order to customise the behaviour and add extra functionality.

This entry was posted in programming and tagged , on by .