001    /**
002     * Copyright (c) 2000-present 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 aQute.bnd.annotation.ProviderType;
018    
019    import java.util.List;
020    
021    /**
022     * @author Brian Wing Shun Chan
023     */
024    @ProviderType
025    public interface JSONFactory {
026    
027            public String convertJSONMLArrayToXML(String jsonml);
028    
029            public String convertJSONMLObjectToXML(String jsonml);
030    
031            public String convertXMLtoJSONMLArray(String xml);
032    
033            public String convertXMLtoJSONMLObject(String xml);
034    
035            public JSONTransformer createJavaScriptNormalizerJSONTransformer(
036                    List<String> javaScriptAttributes);
037    
038            public JSONArray createJSONArray();
039    
040            public JSONArray createJSONArray(String json) throws JSONException;
041    
042            public <T> JSONDeserializer<T> createJSONDeserializer();
043    
044            public JSONObject createJSONObject();
045    
046            public JSONObject createJSONObject(String json) throws JSONException;
047    
048            public JSONSerializer createJSONSerializer();
049    
050            public JSONValidator createJSONValidator(String jsonSchema)
051                    throws JSONException;
052    
053            public Object deserialize(JSONObject jsonObj);
054    
055            public Object deserialize(String json);
056    
057            public String getNullJSON();
058    
059            public JSONObject getUnmodifiableJSONObject();
060    
061            public Object looseDeserialize(String json);
062    
063            public <T> T looseDeserialize(String json, Class<T> clazz);
064    
065            public String looseSerialize(Object object);
066    
067            public String looseSerialize(
068                    Object object, JSONTransformer jsonTransformer, Class<?> clazz);
069    
070            public String looseSerialize(Object object, String... includes);
071    
072            public String looseSerializeDeep(Object object);
073    
074            public String looseSerializeDeep(
075                    Object object, JSONTransformer jsonTransformer, Class<?> clazz);
076    
077            public String serialize(Object object);
078    
079            public String serializeThrowable(Throwable throwable);
080    
081    }