samples/growingparameters/src-api2.0/api/request/response/Compute.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Thu, 30 Oct 2014 21:30:10 +0100
changeset 409 40cabcdcd2be
parent 209 1c999569643b
permissions -rw-r--r--
Updating to NBMs from NetBeans 8.0.1 as some of them are required to run on JDK8
     1 package api.request.response;
     2 
     3 import java.util.List;
     4 import java.util.Map;
     5 
     6 // BEGIN: grow.request.response
     7 public interface Compute {
     8     public void computeData(Request request, Response response);
     9     
    10     public final class Request {
    11         // only getters public, rest hidden only for friend code
    12         Request() {
    13         }
    14     }
    15     
    16     public final class Response {
    17         // only setters public, rest available only for friend code
    18         private final Map<String,String> result;
    19         /** Allow access only to friend code */
    20         Response(Map<String,String> result) {
    21             this.result = result;
    22         }
    23         
    24         public void add(String s) {
    25             result.put(s, s);
    26         }
    27         
    28         public void addAll(List<String> all) {
    29             for (String s : all) {
    30                 add(s);
    31             }
    32         }
    33 
    34         /** @since 2.0 */
    35         public void add(String s, String description) {
    36             result.put(s, description);
    37         }
    38     }
    39 }
    40 // END: grow.request.response