My goal is to take a XML and/or XSD file and dynamically create a Java object that contains costume annotations and load it into the JVM. A 3rd party library would then look for those objects containing that annotation and perform some function to it. example output of what the java object would look like is as follows
import org.optaplanner.core.api.domain.entity.PlanningEntity;
import org.optaplanner.core.api.domain.variable.PlanningVariable;
@PlanningEntity
public class NameAssignment extends ResourceAssignment{
private String name;
@PlanningVariable(valueRangeProviderRefs = { "PlannerCountRange" })
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
The part i'm struggling with is generating the annotation fields @PlanningEntity
and @PlanningVariable(valueRangeProviderRefs = { "PlannerCountRange" })
before, during or after the unmarshalling of the XML.
I've been trying to figure it out with JAXB, Dynamic JAXB, Dynamic JAXB, JavaAssist(for byte code manipulation), JCypher, and XJC(Just for compiling the classes). I even thought about dumping Java altogether and using Groovy. I'm starting to feel like I'm over complicating this and need some guidance. This is a "from scratch" project so I have zero constraints on how I implement it.
Any Help would be greatly appreciated.