Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
IJSONWriter |
|
| 1.0;1 |
1 | // Copyright 2006 The Apache Software Foundation | |
2 | // | |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 | // you may not use this file except in compliance with the License. | |
5 | // You may obtain a copy of the License at | |
6 | // | |
7 | // http://www.apache.org/licenses/LICENSE-2.0 | |
8 | // | |
9 | // Unless required by applicable law or agreed to in writing, software | |
10 | // distributed under the License is distributed on an "AS IS" BASIS, | |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 | // See the License for the specific language governing permissions and | |
13 | // limitations under the License. | |
14 | ||
15 | package org.apache.tapestry.json; | |
16 | ||
17 | ||
18 | /** | |
19 | * JavaScript Object Notation writer which manages two core object response | |
20 | * types, {@link JSONObject} or {@link JSONArray}. It is up to the components | |
21 | * participating in a particular response to decide how to cooperate and build | |
22 | * a JSON structure that their client side will accept. | |
23 | * | |
24 | * @see "http://www.json.org/" | |
25 | * @author JSON.org, jkuhnert | |
26 | */ | |
27 | public interface IJSONWriter | |
28 | { | |
29 | /** | |
30 | * Provides access to the core outer {@link JSONObject} being | |
31 | * rendered to a response. The object may not necessarily be instantiated | |
32 | * until requested, for instances where a response should be a pure array | |
33 | * or other. | |
34 | * | |
35 | * @return The {@link JSONObject} being delegated to. | |
36 | */ | |
37 | JSONObject object(); | |
38 | ||
39 | /** | |
40 | * Provides access to the core outer {@link JSONArray} being | |
41 | * rendered to a response. The object may not necessarily be instantiated | |
42 | * until requested. | |
43 | * | |
44 | * @return The {@link JSONArray} being delegated to. | |
45 | */ | |
46 | JSONArray array(); | |
47 | ||
48 | /** | |
49 | * Causes any un-ended blocks to be closed, as well as | |
50 | * any reasources associated with writer to be flushed/written. | |
51 | */ | |
52 | void close(); | |
53 | ||
54 | /** | |
55 | * Forwards <code>flush()</code> to this <code>IJSONWriter</code>'s | |
56 | * <code>PrintWriter</code>. | |
57 | */ | |
58 | void flush(); | |
59 | } |