001
014
015 package com.liferay.portal.kernel.json;
016
017 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018
019 import java.util.List;
020
021
024 public class JSONFactoryUtil {
025
026 public static String convertJSONMLArrayToXML(String jsonml) {
027 return getJSONFactory().convertJSONMLArrayToXML(jsonml);
028 }
029
030 public static String convertJSONMLObjectToXML(String jsonml) {
031 return getJSONFactory().convertJSONMLObjectToXML(jsonml);
032 }
033
034 public static String convertXMLtoJSONMLArray(String xml) {
035 return getJSONFactory().convertXMLtoJSONMLArray(xml);
036 }
037
038 public static String convertXMLtoJSONMLObject(String xml) {
039 return getJSONFactory().convertXMLtoJSONMLObject(xml);
040 }
041
042 public static JSONTransformer createJavaScriptNormalizerJSONTransformer(
043 List<String> javaScriptAttributes) {
044
045 return getJSONFactory().createJavaScriptNormalizerJSONTransformer(
046 javaScriptAttributes);
047 }
048
049 public static JSONArray createJSONArray() {
050 return getJSONFactory().createJSONArray();
051 }
052
053 public static JSONArray createJSONArray(String json) throws JSONException {
054 return getJSONFactory().createJSONArray(json);
055 }
056
057 public static <T> JSONDeserializer<T> createJSONDeserializer() {
058 return getJSONFactory().createJSONDeserializer();
059 }
060
061 public static JSONObject createJSONObject() {
062 return getJSONFactory().createJSONObject();
063 }
064
065 public static JSONObject createJSONObject(String json)
066 throws JSONException {
067
068 return getJSONFactory().createJSONObject(json);
069 }
070
071 public static JSONSerializer createJSONSerializer() {
072 return getJSONFactory().createJSONSerializer();
073 }
074
075 public static Object deserialize(JSONObject jsonObj) {
076 return getJSONFactory().deserialize(jsonObj);
077 }
078
079 public static Object deserialize(String json) {
080 return getJSONFactory().deserialize(json);
081 }
082
083 public static JSONFactory getJSONFactory() {
084 PortalRuntimePermission.checkGetBeanProperty(JSONFactoryUtil.class);
085
086 return _jsonFactory;
087 }
088
089 public static String getNullJSON() {
090 return getJSONFactory().getNullJSON();
091 }
092
093 public static Object looseDeserialize(String json) {
094 return getJSONFactory().looseDeserialize(json);
095 }
096
097 public static <T> T looseDeserialize(String json, Class<T> clazz) {
098 return getJSONFactory().looseDeserialize(json, clazz);
099 }
100
101 public static Object looseDeserializeSafe(String json) {
102 return getJSONFactory().looseDeserializeSafe(json);
103 }
104
105 public static <T> T looseDeserializeSafe(String json, Class<T> clazz) {
106 return getJSONFactory().looseDeserializeSafe(json, clazz);
107 }
108
109 public static String looseSerialize(Object object) {
110 return getJSONFactory().looseSerialize(object);
111 }
112
113 public static String looseSerialize(
114 Object object, JSONTransformer jsonTransformer, Class<?> clazz) {
115
116 return getJSONFactory().looseSerialize(object, jsonTransformer, clazz);
117 }
118
119 public static String looseSerialize(Object object, String... includes) {
120 return getJSONFactory().looseSerialize(object, includes);
121 }
122
123 public static String looseSerializeDeep(Object object) {
124 return getJSONFactory().looseSerializeDeep(object);
125 }
126
127 public static String looseSerializeDeep(
128 Object object, JSONTransformer jsonTransformer, Class<?> clazz) {
129
130 return getJSONFactory().looseSerializeDeep(
131 object, jsonTransformer, clazz);
132 }
133
134 public static String serialize(Object object) {
135 return getJSONFactory().serialize(object);
136 }
137
138 public static String serializeException(Exception exception) {
139 return getJSONFactory().serializeException(exception);
140 }
141
142 public static String serializeThrowable(Throwable throwable) {
143 return getJSONFactory().serializeThrowable(throwable);
144 }
145
146 public void setJSONFactory(JSONFactory jsonFactory) {
147 PortalRuntimePermission.checkSetBeanProperty(getClass());
148
149 _jsonFactory = jsonFactory;
150 }
151
152 private static JSONFactory _jsonFactory;
153
154 }