001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.json;
016    
017    import java.util.List;
018    
019    /**
020     * @author Brian Wing Shun Chan
021     */
022    public interface JSONFactory {
023    
024            public String convertJSONMLArrayToXML(String jsonml);
025    
026            public String convertJSONMLObjectToXML(String jsonml);
027    
028            public String convertXMLtoJSONMLArray(String xml);
029    
030            public String convertXMLtoJSONMLObject(String xml);
031    
032            public JSONTransformer createJavaScriptNormalizerJSONTransformer(
033                    List<String> javaScriptAttributes);
034    
035            public JSONArray createJSONArray();
036    
037            public JSONArray createJSONArray(String json) throws JSONException;
038    
039            public <T> JSONDeserializer<T> createJSONDeserializer();
040    
041            public JSONObject createJSONObject();
042    
043            public JSONObject createJSONObject(String json) throws JSONException;
044    
045            public JSONSerializer createJSONSerializer();
046    
047            public Object deserialize(JSONObject jsonObj);
048    
049            public Object deserialize(String json);
050    
051            public String getNullJSON();
052    
053            public JSONObject getUnmodifiableJSONObject();
054    
055            public Object looseDeserialize(String json);
056    
057            public <T> T looseDeserialize(String json, Class<T> clazz);
058    
059            public Object looseDeserializeSafe(String json);
060    
061            public <T> T looseDeserializeSafe(String json, Class<T> clazz);
062    
063            public String looseSerialize(Object object);
064    
065            public String looseSerialize(
066                    Object object, JSONTransformer jsonTransformer, Class<?> clazz);
067    
068            public String looseSerialize(Object object, String... includes);
069    
070            public String looseSerializeDeep(Object object);
071    
072            public String looseSerializeDeep(
073                    Object object, JSONTransformer jsonTransformer, Class<?> clazz);
074    
075            public String serialize(Object object);
076    
077            public String serializeException(Exception exception);
078    
079            public String serializeThrowable(Throwable throwable);
080    
081    }