Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a VO instead of a hashmap is better OOP #11

Open
susant123 opened this issue Dec 4, 2013 · 0 comments
Open

Adding a VO instead of a hashmap is better OOP #11

susant123 opened this issue Dec 4, 2013 · 0 comments

Comments

@susant123
Copy link

In Backend.java, we are using HashMap, instead of that a VO will add more OOP features to it.

For example in below code snippet:

Instead of:

Map<String, Object> object = new HashMap<String, Object>();

lets use a VO:

public Map<String, Object> rpc(String module, String member, Object argument) throws ParseException, IOException, JsonSyntaxException, BackendException {
    Map<String, Object> object = new HashMap<String, Object>();
    object.put(Backend.KEY_MODULE, module);
    object.put(Backend.KEY_MEMBER, member);
    object.put(Backend.KEY_ARGUMENT, argument);

    String json = gson.toJson(object);

    StringEntity content = new StringEntity(json);
    this.rpc.setEntity(content);

    return this.postJson(this.rpc);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant