I am doing a Rule Based Mapping using XML.
Rules.xml
<?xml version="1.0" ?> 
  <rules> 
   <name>Rule1</name>
    <sourcefield>employeeName</sourcefield>   
    <targetfield>Name</targetfield>    
   </rules>
The Pojo's are below
public class Employee{
    String employeeName;
    public String getEmployeeName() {
    return employeeName;
    }
    public void setEmployeeName(String employeeName) {
    this.employeeName = employeeName;
    }
} 
package main;
public class Emp{
    String name;
    public String getName() {
    return name;
    }
    public void setName(String name) {
    this.name= name;
    }
}
The sourcefield and targetfield values are variables defined in the POJO's (Employee and Emp). In my controlller class, I am trying to fetch the source and target fields from the Rules.xml and try to form the JAVA code dynamically based on these source and target values.
for example:
I get the sourcefield and targetfield values after parsing the XML
String source = eElement.getElementsByTagName("sourcefield").item(0).getTextContent(); String target= eElement.getElementsByTagName("targetfield").item(0).getTextContent();
Now, if source value is 'employeeName' and target value is 'name' then I need to form the JAVA code as Employee.setEmployeeName() and Emp.setName() respectively.
Is there a way how to do this?
