protected String
getJobString (Job job)
throws NoSuchMethodException, ClassNotFoundException,
InvocationTargetException, IllegalAccessException, NoSuchFieldException
{
return String.format ("%nID: %d%n" +
"Name: %s\n" +
"Name: %s%n" +
"Employer: %s\n" +
"Employer: %s%n" +
"Location: %s\n" +
"Location: %s%n" +
"Position Type: %s\n" +
"Position Type: %s%n" +
"Core Competency: %s\n",
getJobId (job),
getJobFieldString (job,"name",true),
getJobFieldString (job,"employer",true),
getJobFieldString (job,"location",true),
"Core Competency: %s%n",getJobId (job),
getJobFieldString (job,"name",true),
getJobFieldString (job,"employer",true),
getJobFieldString (job,"location",true),
getJobFieldString (job,"positionType",true),
getJobFieldString (job, "coreCompetency", true));
getJobFieldString (job, "positionType", true),
getJobFieldString (job, "coreCompetency", true));
}
}
Code readability
The following code is hard to read and maintain. It should used functional design with single responsibility principles to clean up the logic and flow of the method calls. Additionally,
String.format ( )can be a function call and abstracted from thegetJobString()and called withing each method.