| author | Jaroslav Tulach <jtulach@netbeans.org> |
| Fri Aug 27 14:06:39 2010 +0200 | |
| changeset 365 | 0b7ec6ef8a72 |
| parent 209 | 1c999569643b |
| permissions | -rw-r--r-- |
| jtulach@78 | 1 |
package api.request.response; |
| jtulach@78 | 2 |
|
| jtulach@78 | 3 |
import java.util.List; |
| jtulach@78 | 4 |
import java.util.Map; |
| jtulach@78 | 5 |
|
| jtulach@78 | 6 |
// BEGIN: grow.request.response |
| jtulach@78 | 7 |
public interface Compute {
|
| jtulach@78 | 8 |
public void computeData(Request request, Response response); |
| jtulach@78 | 9 |
|
| jtulach@78 | 10 |
public final class Request {
|
| jtulach@78 | 11 |
// only getters public, rest hidden only for friend code |
| jtulach@78 | 12 |
Request() {
|
| jtulach@78 | 13 |
} |
| jtulach@78 | 14 |
} |
| jtulach@78 | 15 |
|
| jtulach@78 | 16 |
public final class Response {
|
| jtulach@78 | 17 |
// only setters public, rest available only for friend code |
| jtulach@78 | 18 |
private final Map<String,String> result; |
| jtulach@78 | 19 |
/** Allow access only to friend code */ |
| jtulach@78 | 20 |
Response(Map<String,String> result) {
|
| jtulach@78 | 21 |
this.result = result; |
| jtulach@78 | 22 |
} |
| jtulach@78 | 23 |
|
| jtulach@78 | 24 |
public void add(String s) {
|
| jtulach@210 | 25 |
result.put(s, s); |
| jtulach@78 | 26 |
} |
| jtulach@78 | 27 |
|
| jtulach@78 | 28 |
public void addAll(List<String> all) {
|
| jtulach@78 | 29 |
for (String s : all) {
|
| jtulach@78 | 30 |
add(s); |
| jtulach@78 | 31 |
} |
| jtulach@78 | 32 |
} |
| jtulach@78 | 33 |
|
| jtulach@78 | 34 |
/** @since 2.0 */ |
| jtulach@78 | 35 |
public void add(String s, String description) {
|
| jtulach@210 | 36 |
result.put(s, description); |
| jtulach@78 | 37 |
} |
| jtulach@78 | 38 |
} |
| jtulach@78 | 39 |
} |
| jtulach@78 | 40 |
// END: grow.request.response |