mirror of
https://github.com/apache/struts.git
synced 2026-08-07 07:37:20 +00:00
Removed unused methods
Removed JSONUtil.serialize(Object) in favor for using the method that accepts a boolean to control bean caching functionality.
This commit is contained in:
@@ -55,22 +55,10 @@ import com.opensymphony.xwork2.util.WildcardUtil;
|
||||
public class JSONUtil {
|
||||
|
||||
public final static String RFC3339_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";
|
||||
|
||||
public static final boolean CACHE_BEAN_INFO_DEFAULT = true;
|
||||
|
||||
private static final Logger LOG = LogManager.getLogger(JSONUtil.class);
|
||||
private static final boolean CACHE_BEAN_INFO_DEFAULT = true;
|
||||
|
||||
/**
|
||||
* Serializes an object into JSON.
|
||||
*
|
||||
* @param object
|
||||
* to be serialized
|
||||
* @return JSON string
|
||||
* @throws JSONException
|
||||
*/
|
||||
public static String serialize(Object object) throws JSONException {
|
||||
return serialize(object, CACHE_BEAN_INFO_DEFAULT);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Serializes an object into JSON.
|
||||
*
|
||||
|
||||
@@ -20,16 +20,6 @@
|
||||
*/
|
||||
package org.apache.struts2.json;
|
||||
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.mock.MockActionInvocation;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import org.apache.struts2.StrutsStatics;
|
||||
import org.apache.struts2.StrutsTestCase;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
import org.springframework.mock.web.MockServletContext;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -45,6 +35,18 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.struts2.StrutsStatics;
|
||||
import org.apache.struts2.StrutsTestCase;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
import org.springframework.mock.web.MockServletContext;
|
||||
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.mock.MockActionInvocation;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
|
||||
/**
|
||||
* JSONResultTest
|
||||
*/
|
||||
@@ -60,7 +62,7 @@ public class JSONResultTest extends StrutsTestCase {
|
||||
Map map = new HashMap();
|
||||
map.put("createtime", new Date());
|
||||
try {
|
||||
JSONUtil.serialize(map);
|
||||
JSONUtil.serialize(map, JSONUtil.CACHE_BEAN_INFO_DEFAULT);
|
||||
} catch (JSONException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class JSONUtilTest extends TestCase {
|
||||
bean1.setEnumField(AnEnum.ValueA);
|
||||
bean1.setEnumBean(AnEnumBean.Two);
|
||||
|
||||
String json = JSONUtil.serialize(bean1);
|
||||
String json = JSONUtil.serialize(bean1, JSONUtil.CACHE_BEAN_INFO_DEFAULT);
|
||||
|
||||
Map result = (Map) JSONUtil.deserialize(json);
|
||||
assertEquals("str", result.get("stringField"));
|
||||
|
||||
Reference in New Issue
Block a user