1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/samples/growingparameters/src-api2.0/api/request/response/Compute.java Sat Jun 14 09:53:38 2008 +0200
1.3 @@ -0,0 +1,40 @@
1.4 +package api.request.response;
1.5 +
1.6 +import java.util.List;
1.7 +import java.util.Map;
1.8 +
1.9 +// BEGIN: grow.request.response
1.10 +public interface Compute {
1.11 + public void computeData(Request request, Response response);
1.12 +
1.13 + public final class Request {
1.14 + // only getters public, rest hidden only for friend code
1.15 + Request() {
1.16 + }
1.17 + }
1.18 +
1.19 + public final class Response {
1.20 + // only setters public, rest available only for friend code
1.21 + private final Map<String,String> result;
1.22 + /** Allow access only to friend code */
1.23 + Response(Map<String,String> result) {
1.24 + this.result = result;
1.25 + }
1.26 +
1.27 + public void add(String s) {
1.28 + this.result.put(s, s);
1.29 + }
1.30 +
1.31 + public void addAll(List<String> all) {
1.32 + for (String s : all) {
1.33 + add(s);
1.34 + }
1.35 + }
1.36 +
1.37 + /** @since 2.0 */
1.38 + public void add(String s, String description) {
1.39 + this.result.put(s, description);
1.40 + }
1.41 + }
1.42 +}
1.43 +// END: grow.request.response