001    /**
002     * Copyright (c) 2000-2012 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 Object looseDeserialize(String json);
054    
055            public <T> T looseDeserialize(String json, Class<T> clazz);
056    
057            public String looseSerialize(Object object);
058    
059            public String looseSerialize(
060                    Object object, JSONTransformer jsonTransformer, Class<?> clazz);
061    
062            public String looseSerialize(Object object, String... includes);
063    
064            public String looseSerializeDeep(Object object);
065    
066            public String looseSerializeDeep(
067                    Object object, JSONTransformer jsonTransformer, Class<?> clazz);
068    
069            public String serialize(Object object);
070    
071            public String serializeException(Exception exception);
072    
073    }