I'm trying to generate the entity class for a Cassandra column family from the column family definition (a .cql file), programmatically.
To achieve that I've used the arch4j java code generator. But, unfortunately, I didn't find any solution to create annotations using this API. So, I used Javassist to add annotations to the generated entity class. Again, as this Javassist API deals with the Java byte code, I had to use a Java decompiler (e.g. Procyon) to decompile the class file generated by Javassist.
Is there any simpler way to achieve my target?
Well, I took another approach towards solving my problem and ended up with JavaPoet and Project Lombok APIs. I've used JavaPoet to generate the .java file with the required annotations for the entity. Then I've processed that file using Lombok/Delombok to generate the getters, setters, hashCode, equals and toString methods.