本文整理匯總了Java中org.codehaus.jackson.map.DeserializationContext.weirdStringException方法的典型用法代碼示例。如果您正苦於以下問題:Java DeserializationContext.weirdStringException方法的具體用法?Java DeserializationContext.weirdStringException怎麽用?Java DeserializationContext.weirdStringException使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.codehaus.jackson.map.DeserializationContext
的用法示例。
在下文中一共展示了DeserializationContext.weirdStringException方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: _parseBooleanPrimitive
import org.codehaus.jackson.map.DeserializationContext; //導入方法依賴的package包/類
protected final boolean _parseBooleanPrimitive(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
JsonToken localJsonToken = paramJsonParser.getCurrentToken();
if (localJsonToken == JsonToken.VALUE_TRUE);
while (true)
{
return true;
if (localJsonToken == JsonToken.VALUE_FALSE)
return false;
if (localJsonToken == JsonToken.VALUE_NULL)
return false;
if (localJsonToken == JsonToken.VALUE_NUMBER_INT)
if (paramJsonParser.getIntValue() == 0)
return false;
if (localJsonToken != JsonToken.VALUE_STRING)
break;
String str = paramJsonParser.getText().trim();
if ("true".equals(str))
continue;
if (("false".equals(str)) || (str.length() == 0))
return Boolean.FALSE.booleanValue();
throw paramDeserializationContext.weirdStringException(this._valueClass, "only \"true\" or \"false\" recognized");
}
throw paramDeserializationContext.mappingException(this._valueClass);
}
示例2: _parseDate
import org.codehaus.jackson.map.DeserializationContext; //導入方法依賴的package包/類
protected java.util.Date _parseDate(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
JsonToken localJsonToken = paramJsonParser.getCurrentToken();
try
{
if (localJsonToken == JsonToken.VALUE_NUMBER_INT)
return new java.util.Date(paramJsonParser.getLongValue());
if (localJsonToken == JsonToken.VALUE_STRING)
{
String str = paramJsonParser.getText().trim();
if (str.length() == 0)
return null;
return paramDeserializationContext.parseDate(str);
}
throw paramDeserializationContext.mappingException(this._valueClass);
}
catch (IllegalArgumentException localIllegalArgumentException)
{
}
throw paramDeserializationContext.weirdStringException(this._valueClass, "not a valid representation (error: " + localIllegalArgumentException.getMessage() + ")");
}
示例3: deserialize
import org.codehaus.jackson.map.DeserializationContext; //導入方法依賴的package包/類
public BigDecimal deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
JsonToken localJsonToken = paramJsonParser.getCurrentToken();
if ((localJsonToken == JsonToken.VALUE_NUMBER_INT) || (localJsonToken == JsonToken.VALUE_NUMBER_FLOAT))
return paramJsonParser.getDecimalValue();
if (localJsonToken == JsonToken.VALUE_STRING)
{
String str = paramJsonParser.getText().trim();
if (str.length() == 0)
return null;
try
{
BigDecimal localBigDecimal = new BigDecimal(str);
return localBigDecimal;
}
catch (IllegalArgumentException localIllegalArgumentException)
{
throw paramDeserializationContext.weirdStringException(this._valueClass, "not a valid representation");
}
}
throw paramDeserializationContext.mappingException(this._valueClass);
}
示例4: deserialize
import org.codehaus.jackson.map.DeserializationContext; //導入方法依賴的package包/類
public EnumMap<?, ?> deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
if (paramJsonParser.getCurrentToken() != JsonToken.START_OBJECT)
throw paramDeserializationContext.mappingException(EnumMap.class);
EnumMap localEnumMap = constructMap();
if (paramJsonParser.nextToken() != JsonToken.END_OBJECT)
{
String str = paramJsonParser.getCurrentName();
Enum localEnum = this._enumResolver.findEnum(str);
if (localEnum == null)
throw paramDeserializationContext.weirdStringException(this._enumResolver.getEnumClass(), "value not one of declared Enum instance names");
if (paramJsonParser.nextToken() == JsonToken.VALUE_NULL);
for (Object localObject = null; ; localObject = this._valueDeserializer.deserialize(paramJsonParser, paramDeserializationContext))
{
localEnumMap.put(localEnum, localObject);
break;
}
}
return localEnumMap;
}
示例5: deserialize
import org.codehaus.jackson.map.DeserializationContext; //導入方法依賴的package包/類
public Enum<?> deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
JsonToken localJsonToken = paramJsonParser.getCurrentToken();
if (localJsonToken == JsonToken.VALUE_STRING)
{
String str = paramJsonParser.getText();
Enum localEnum2 = this._resolver.findEnum(str);
if (localEnum2 == null)
throw paramDeserializationContext.weirdStringException(this._resolver.getEnumClass(), "value not one of declared Enum instance names");
return localEnum2;
}
if (localJsonToken == JsonToken.VALUE_NUMBER_INT)
{
if (paramDeserializationContext.isEnabled(DeserializationConfig.Feature.FAIL_ON_NUMBERS_FOR_ENUMS))
throw paramDeserializationContext.mappingException("Not allowed to deserialize Enum value out of JSON number (disable DeserializationConfig.Feature.FAIL_ON_NUMBERS_FOR_ENUMS to allow)");
int i = paramJsonParser.getIntValue();
Enum localEnum1 = this._resolver.getEnum(i);
if (localEnum1 == null)
throw paramDeserializationContext.weirdNumberException(this._resolver.getEnumClass(), "index value outside legal index range [0.." + this._resolver.lastValidIndex() + "]");
return localEnum1;
}
throw paramDeserializationContext.mappingException(this._resolver.getEnumClass());
}
示例6: _parseBoolean
import org.codehaus.jackson.map.DeserializationContext; //導入方法依賴的package包/類
protected final Boolean _parseBoolean(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
JsonToken localJsonToken = paramJsonParser.getCurrentToken();
if (localJsonToken == JsonToken.VALUE_TRUE)
return Boolean.TRUE;
if (localJsonToken == JsonToken.VALUE_FALSE)
return Boolean.FALSE;
if (localJsonToken == JsonToken.VALUE_NULL)
return null;
if (localJsonToken == JsonToken.VALUE_NUMBER_INT)
{
if (paramJsonParser.getIntValue() == 0)
return Boolean.FALSE;
return Boolean.TRUE;
}
if (localJsonToken == JsonToken.VALUE_STRING)
{
String str = paramJsonParser.getText().trim();
if ("true".equals(str))
return Boolean.TRUE;
if (("false".equals(str)) || (str.length() == 0))
return Boolean.FALSE;
throw paramDeserializationContext.weirdStringException(this._valueClass, "only \"true\" or \"false\" recognized");
}
throw paramDeserializationContext.mappingException(this._valueClass);
}
示例7: _parseLong
import org.codehaus.jackson.map.DeserializationContext; //導入方法依賴的package包/類
protected final Long _parseLong(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
JsonToken localJsonToken1 = paramJsonParser.getCurrentToken();
Long localLong1;
if ((localJsonToken1 == JsonToken.VALUE_NUMBER_INT) || (localJsonToken1 == JsonToken.VALUE_NUMBER_FLOAT))
localLong1 = Long.valueOf(paramJsonParser.getLongValue());
JsonToken localJsonToken2;
do
{
while (true)
{
return localLong1;
if (localJsonToken1 != JsonToken.VALUE_STRING)
break;
String str = paramJsonParser.getText().trim();
int i = str.length();
localLong1 = null;
if (i == 0)
continue;
try
{
Long localLong2 = Long.valueOf(NumberInput.parseLong(str));
return localLong2;
}
catch (IllegalArgumentException localIllegalArgumentException)
{
throw paramDeserializationContext.weirdStringException(this._valueClass, "not a valid Long value");
}
}
localJsonToken2 = JsonToken.VALUE_NULL;
localLong1 = null;
}
while (localJsonToken1 == localJsonToken2);
throw paramDeserializationContext.mappingException(this._valueClass);
}
示例8: _parseLongPrimitive
import org.codehaus.jackson.map.DeserializationContext; //導入方法依賴的package包/類
protected final long _parseLongPrimitive(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
long l1 = 0L;
JsonToken localJsonToken = paramJsonParser.getCurrentToken();
if ((localJsonToken == JsonToken.VALUE_NUMBER_INT) || (localJsonToken == JsonToken.VALUE_NUMBER_FLOAT))
l1 = paramJsonParser.getLongValue();
do
while (true)
{
return l1;
if (localJsonToken != JsonToken.VALUE_STRING)
break;
String str = paramJsonParser.getText().trim();
if (str.length() == 0)
continue;
try
{
long l2 = NumberInput.parseLong(str);
return l2;
}
catch (IllegalArgumentException localIllegalArgumentException)
{
throw paramDeserializationContext.weirdStringException(this._valueClass, "not a valid long value");
}
}
while (localJsonToken == JsonToken.VALUE_NULL);
throw paramDeserializationContext.mappingException(this._valueClass);
}
示例9: _parseShort
import org.codehaus.jackson.map.DeserializationContext; //導入方法依賴的package包/類
protected final Short _parseShort(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
JsonToken localJsonToken = paramJsonParser.getCurrentToken();
if (localJsonToken == JsonToken.VALUE_NULL)
return null;
if ((localJsonToken == JsonToken.VALUE_NUMBER_INT) || (localJsonToken == JsonToken.VALUE_NUMBER_FLOAT))
return Short.valueOf(paramJsonParser.getShortValue());
int i = _parseIntPrimitive(paramJsonParser, paramDeserializationContext);
if ((i < -32768) || (i > 32767))
throw paramDeserializationContext.weirdStringException(this._valueClass, "overflow, value can not be represented as 16-bit value");
return Short.valueOf((short)i);
}
示例10: _parseShortPrimitive
import org.codehaus.jackson.map.DeserializationContext; //導入方法依賴的package包/類
protected final short _parseShortPrimitive(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
int i = _parseIntPrimitive(paramJsonParser, paramDeserializationContext);
if ((i < -32768) || (i > 32767))
throw paramDeserializationContext.weirdStringException(this._valueClass, "overflow, value can not be represented as 16-bit value");
return (short)i;
}
示例11: deserialize
import org.codehaus.jackson.map.DeserializationContext; //導入方法依賴的package包/類
public final T deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
String str;
Object localObject2;
if (paramJsonParser.getCurrentToken() == JsonToken.VALUE_STRING)
{
str = paramJsonParser.getText().trim();
int i = str.length();
localObject2 = null;
if (i != 0);
}
while (true)
{
return localObject2;
try
{
Object localObject3 = _deserialize(str, paramDeserializationContext);
localObject2 = localObject3;
if (localObject2 != null)
continue;
label55: throw paramDeserializationContext.weirdStringException(this._valueClass, "not a valid textual representation");
if (paramJsonParser.getCurrentToken() == JsonToken.VALUE_EMBEDDED_OBJECT)
{
Object localObject1 = paramJsonParser.getEmbeddedObject();
localObject2 = null;
if (localObject1 == null)
continue;
if (this._valueClass.isAssignableFrom(localObject1.getClass()))
return localObject1;
return _deserializeEmbedded(localObject1, paramDeserializationContext);
}
throw paramDeserializationContext.mappingException(this._valueClass);
}
catch (IllegalArgumentException localIllegalArgumentException)
{
break label55;
}
}
}
示例12: _parseDouble
import org.codehaus.jackson.map.DeserializationContext; //導入方法依賴的package包/類
protected final Double _parseDouble(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
JsonToken localJsonToken1 = paramJsonParser.getCurrentToken();
Double localDouble1;
if ((localJsonToken1 == JsonToken.VALUE_NUMBER_INT) || (localJsonToken1 == JsonToken.VALUE_NUMBER_FLOAT))
localDouble1 = Double.valueOf(paramJsonParser.getDoubleValue());
JsonToken localJsonToken2;
do
{
while (true)
{
return localDouble1;
if (localJsonToken1 != JsonToken.VALUE_STRING)
break;
String str = paramJsonParser.getText().trim();
int i = str.length();
localDouble1 = null;
if (i == 0)
continue;
switch (str.charAt(0))
{
default:
case 'I':
case 'N':
case '-':
}
try
{
do
{
do
{
do
{
Double localDouble2 = Double.valueOf(parseDouble(str));
return localDouble2;
}
while ((!"Infinity".equals(str)) && (!"INF".equals(str)));
return Double.valueOf((1.0D / 0.0D));
}
while (!"NaN".equals(str));
return Double.valueOf((0.0D / 0.0D));
}
while ((!"-Infinity".equals(str)) && (!"-INF".equals(str)));
return Double.valueOf((-1.0D / 0.0D));
}
catch (IllegalArgumentException localIllegalArgumentException)
{
throw paramDeserializationContext.weirdStringException(this._valueClass, "not a valid Double value");
}
}
localJsonToken2 = JsonToken.VALUE_NULL;
localDouble1 = null;
}
while (localJsonToken1 == localJsonToken2);
throw paramDeserializationContext.mappingException(this._valueClass);
}
示例13: _parseDoublePrimitive
import org.codehaus.jackson.map.DeserializationContext; //導入方法依賴的package包/類
protected final double _parseDoublePrimitive(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
double d1 = 0.0D;
JsonToken localJsonToken = paramJsonParser.getCurrentToken();
if ((localJsonToken == JsonToken.VALUE_NUMBER_INT) || (localJsonToken == JsonToken.VALUE_NUMBER_FLOAT))
d1 = paramJsonParser.getDoubleValue();
do
while (true)
{
return d1;
if (localJsonToken != JsonToken.VALUE_STRING)
break;
String str = paramJsonParser.getText().trim();
if (str.length() == 0)
continue;
switch (str.charAt(0))
{
default:
case 'I':
case 'N':
case '-':
}
try
{
do
{
do
{
do
{
double d2 = parseDouble(str);
return d2;
}
while ((!"Infinity".equals(str)) && (!"INF".equals(str)));
return (1.0D / 0.0D);
}
while (!"NaN".equals(str));
return (0.0D / 0.0D);
}
while ((!"-Infinity".equals(str)) && (!"-INF".equals(str)));
return (-1.0D / 0.0D);
}
catch (IllegalArgumentException localIllegalArgumentException)
{
throw paramDeserializationContext.weirdStringException(this._valueClass, "not a valid double value");
}
}
while (localJsonToken == JsonToken.VALUE_NULL);
throw paramDeserializationContext.mappingException(this._valueClass);
}
示例14: _parseFloat
import org.codehaus.jackson.map.DeserializationContext; //導入方法依賴的package包/類
protected final Float _parseFloat(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
JsonToken localJsonToken1 = paramJsonParser.getCurrentToken();
Float localFloat1;
if ((localJsonToken1 == JsonToken.VALUE_NUMBER_INT) || (localJsonToken1 == JsonToken.VALUE_NUMBER_FLOAT))
localFloat1 = Float.valueOf(paramJsonParser.getFloatValue());
JsonToken localJsonToken2;
do
{
while (true)
{
return localFloat1;
if (localJsonToken1 != JsonToken.VALUE_STRING)
break;
String str = paramJsonParser.getText().trim();
int i = str.length();
localFloat1 = null;
if (i == 0)
continue;
switch (str.charAt(0))
{
default:
case 'I':
case 'N':
case '-':
}
try
{
do
{
do
{
do
{
Float localFloat2 = Float.valueOf(Float.parseFloat(str));
return localFloat2;
}
while ((!"Infinity".equals(str)) && (!"INF".equals(str)));
return Float.valueOf((1.0F / 1.0F));
}
while (!"NaN".equals(str));
return Float.valueOf((0.0F / 0.0F));
}
while ((!"-Infinity".equals(str)) && (!"-INF".equals(str)));
return Float.valueOf((1.0F / -1.0F));
}
catch (IllegalArgumentException localIllegalArgumentException)
{
throw paramDeserializationContext.weirdStringException(this._valueClass, "not a valid Float value");
}
}
localJsonToken2 = JsonToken.VALUE_NULL;
localFloat1 = null;
}
while (localJsonToken1 == localJsonToken2);
throw paramDeserializationContext.mappingException(this._valueClass);
}
示例15: _parseFloatPrimitive
import org.codehaus.jackson.map.DeserializationContext; //導入方法依賴的package包/類
protected final float _parseFloatPrimitive(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
JsonToken localJsonToken1 = paramJsonParser.getCurrentToken();
float f1;
if ((localJsonToken1 == JsonToken.VALUE_NUMBER_INT) || (localJsonToken1 == JsonToken.VALUE_NUMBER_FLOAT))
f1 = paramJsonParser.getFloatValue();
JsonToken localJsonToken2;
do
{
while (true)
{
return f1;
if (localJsonToken1 != JsonToken.VALUE_STRING)
break;
String str = paramJsonParser.getText().trim();
int i = str.length();
f1 = 0.0F;
if (i == 0)
continue;
switch (str.charAt(0))
{
default:
case 'I':
case 'N':
case '-':
}
try
{
do
{
do
{
do
{
float f2 = Float.parseFloat(str);
return f2;
}
while ((!"Infinity".equals(str)) && (!"INF".equals(str)));
return (1.0F / 1.0F);
}
while (!"NaN".equals(str));
return (0.0F / 0.0F);
}
while ((!"-Infinity".equals(str)) && (!"-INF".equals(str)));
return (1.0F / -1.0F);
}
catch (IllegalArgumentException localIllegalArgumentException)
{
throw paramDeserializationContext.weirdStringException(this._valueClass, "not a valid float value");
}
}
localJsonToken2 = JsonToken.VALUE_NULL;
f1 = 0.0F;
}
while (localJsonToken1 == localJsonToken2);
throw paramDeserializationContext.mappingException(this._valueClass);
}