01: /*
02: * Copyright 2007 Google Inc.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
05: * use this file except in compliance with the License. You may obtain a copy of
06: * the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13: * License for the specific language governing permissions and limitations under
14: * the License.
15: */
16: package com.google.gwt.json.client;
17:
18: /**
19: * The superclass of all JSON value types.
20: *
21: * @see com.google.gwt.json.client.JSONArray
22: * @see com.google.gwt.json.client.JSONBoolean
23: * @see com.google.gwt.json.client.JSONNumber
24: * @see com.google.gwt.json.client.JSONObject
25: * @see com.google.gwt.json.client.JSONString
26: */
27: public abstract class JSONValue {
28: /**
29: * Returns a non-null reference if this JSONValue is really a JSONArray.
30: *
31: * @return a reference to a JSONArray if this JSONValue is a JSONArray or
32: * <code>null</code> otherwise.
33: */
34: public JSONArray isArray() {
35: return null;
36: }
37:
38: /**
39: * Returns a non-null reference if this JSONValue is really a JSONBoolean.
40: *
41: * @return a reference to a JSONBoolean if this JSONValue is a JSONBoolean or
42: * <code>null</code> otherwise.
43: */
44: public JSONBoolean isBoolean() {
45: return null;
46: }
47:
48: /**
49: * Returns a non-null reference if this JSONValue is really a JSONNull.
50: *
51: * @return a reference to a JSONNull if this JSONValue is a JSONNull or
52: * <code>null</code> otherwise.
53: */
54: public JSONNull isNull() {
55: return null;
56: }
57:
58: /**
59: * Returns a non-null reference if this JSONValue is really a JSONNumber.
60: *
61: * @return a reference to a JSONNumber if this JSONValue is a JSONNumber or
62: * <code>null</code> otherwise.
63: */
64: public JSONNumber isNumber() {
65: return null;
66: }
67:
68: /**
69: * Returns non-null if this JSONValue is really a JSONObject.
70: *
71: * @return a reference to a JSONObject if this JSONValue is a JSONObject or
72: * <code>null</code> otherwise.
73: */
74: public JSONObject isObject() {
75: return null;
76: }
77:
78: /**
79: * Returns a non-null reference if this JSONValue is really a JSONString.
80: *
81: * @return a reference to a JSONString if this JSONValue is a JSONString or
82: * <code>null</code> otherwise.
83: */
84: public JSONString isString() {
85: return null;
86: }
87:
88: /**
89: * Returns a JSON-encoded string for this entity. Use this method to create
90: * JSON strings that can be sent from the client to a server.
91: */
92: @Override
93: public abstract String toString() throws JSONException;
94: }
|