
jp.go.nict.langrid.commons.beanutils.ConverterForJsonRpc Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jp.go.nict.langrid.commons Show documentation
Show all versions of jp.go.nict.langrid.commons Show documentation
Common and utility library for the Service Grid Server Software and java web services.
The newest version!
package jp.go.nict.langrid.commons.beanutils;
import java.lang.reflect.Array;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Map;
import jp.go.nict.langrid.commons.transformer.TransformationException;
import jp.go.nict.langrid.commons.transformer.Transformer;
import jp.go.nict.langrid.repackaged.net.arnx.jsonic.JSON;
public class ConverterForJsonRpc extends Converter{
@SuppressWarnings("unchecked")
@Override
public T convert(Object value, Class target)
throws ConversionException {
if(value instanceof String && value.equals("[]") && target.isArray()){
return (T)Array.newInstance(target.getComponentType(), 0);
}
try{
return super.convert(value, target);
} catch(ConversionException e){
return null;
}
}
@SuppressWarnings("rawtypes")
public ConverterForJsonRpc() {
addTransformerConversion(Map.class, String.class, new Transformer
© 2015 - 2025 Weber Informatics LLC | Privacy Policy