001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.json;
016    
017    import java.io.Writer;
018    
019    import java.util.Date;
020    import java.util.Iterator;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     */
025    public interface JSONObject {
026    
027            public boolean getBoolean(String key);
028    
029            public double getDouble(String key);
030    
031            public int getInt(String key);
032    
033            public JSONArray getJSONArray(String key);
034    
035            public JSONObject getJSONObject(String key);
036    
037            public long getLong(String key);
038    
039            public String getString(String key);
040    
041            public boolean has(String key);
042    
043            public boolean isNull(String key);
044    
045            public Iterator<String> keys();
046    
047            public int length();
048    
049            public JSONArray names();
050    
051            public JSONObject put(String key, boolean value);
052    
053            public JSONObject put(String key, double value);
054    
055            public JSONObject put(String key, int value);
056    
057            public JSONObject put(String key, long value);
058    
059            public JSONObject put(String key, Date value);
060    
061            public JSONObject put(String key, JSONArray value);
062    
063            public JSONObject put(String key, JSONObject value);
064    
065            public JSONObject put(String key, String value);
066    
067            public Object remove(String key);
068    
069            public String toString();
070    
071            public String toString(int indentFactor) throws JSONException;
072    
073            public Writer write(Writer writer) throws JSONException;
074    
075    }