PersonJsonParser jsonParser = new PersonJsonParser();
try {
JSONObject mainJson = new JSONObject(searchRequest);
JSONArray personsArray = mainJson.getJSONArray("persons");
response = jsonParser.parse(personsArray,headers);
return response;
}
catch(JSONException ex) {
...
}
catch(Exception ex) {
...
}
}
}
//PersonJsonParser
class PersonJsonParser
{
...
public Response parse(JSONArray personsArray, RequestHeaders headers) {
...
StringBuffer outDocument = new StringBuffer();
try
{
for (int i = 0; i < personsArray.length(); i++)
{
JSONObject outputJson;
outputJson = getPersonOutputJson((JSONObject)usersArray.get(i),headers);
...
DBHandler.write(outputJson);
outDocument.append(outpuJson);
..
} // end for loop
//if some docs to be written on FileSystem
if(outDocument.length() > 1 ) {
...
FileHandler.createFile(outDocument);
...
}
} catch(Exception ex) {
...
}
//DBHandler
class DBHandler
{
...
public void write(..)
{....}
}
//FileHandler
class FileHandler
{
...
public void createFile(...)
{
...
}
}
Hello,I wanted to get some thoughts/ or confirm class design for below feed scenario from Single Responsibility principle perspective and also wanted to confirm if calling DBHandler & FileHandler methods from PersonJsonParser.parse(..) method below violates SRP from any perspective and if so, how should I design.
--
---
You received this message because you are subscribed to the Google Groups "Growing Object-Oriented Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to growing-object-oriente...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.