jtulach@78: package api.request.response; jtulach@78: jtulach@78: import java.util.List; jtulach@78: import java.util.Map; jtulach@78: jtulach@78: // BEGIN: grow.request.response jtulach@78: public interface Compute { jtulach@78: public void computeData(Request request, Response response); jtulach@78: jtulach@78: public final class Request { jtulach@78: // only getters public, rest hidden only for friend code jtulach@78: Request() { jtulach@78: } jtulach@78: } jtulach@78: jtulach@78: public final class Response { jtulach@78: // only setters public, rest available only for friend code jtulach@78: private final Map result; jtulach@78: /** Allow access only to friend code */ jtulach@78: Response(Map result) { jtulach@78: this.result = result; jtulach@78: } jtulach@78: jtulach@78: public void add(String s) { jtulach@210: result.put(s, s); jtulach@78: } jtulach@78: jtulach@78: public void addAll(List all) { jtulach@78: for (String s : all) { jtulach@78: add(s); jtulach@78: } jtulach@78: } jtulach@78: jtulach@78: /** @since 2.0 */ jtulach@78: public void add(String s, String description) { jtulach@210: result.put(s, description); jtulach@78: } jtulach@78: } jtulach@78: } jtulach@78: // END: grow.request.response