本文整理汇总了Java中org.codehaus.jackson.map.DeserializationContext.isEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java DeserializationContext.isEnabled方法的具体用法?Java DeserializationContext.isEnabled怎么用?Java DeserializationContext.isEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.codehaus.jackson.map.DeserializationContext
的用法示例。
在下文中一共展示了DeserializationContext.isEnabled方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleNonArray
import org.codehaus.jackson.map.DeserializationContext; //导入方法依赖的package包/类
private final Collection<Object> handleNonArray(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext, Collection<Object> paramCollection)
throws IOException, JsonProcessingException
{
if (!paramDeserializationContext.isEnabled(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY))
throw paramDeserializationContext.mappingException(this._collectionType.getRawClass());
JsonDeserializer localJsonDeserializer = this._valueDeserializer;
TypeDeserializer localTypeDeserializer = this._valueTypeDeserializer;
Object localObject;
if (paramJsonParser.getCurrentToken() == JsonToken.VALUE_NULL)
localObject = null;
while (true)
{
paramCollection.add(localObject);
return paramCollection;
if (localTypeDeserializer == null)
{
localObject = localJsonDeserializer.deserialize(paramJsonParser, paramDeserializationContext);
continue;
}
localObject = localJsonDeserializer.deserializeWithType(paramJsonParser, paramDeserializationContext, localTypeDeserializer);
}
}
示例2: 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());
}
示例3: handleNonArray
import org.codehaus.jackson.map.DeserializationContext; //导入方法依赖的package包/类
private final Collection<String> handleNonArray(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext, Collection<String> paramCollection)
throws IOException, JsonProcessingException
{
if (!paramDeserializationContext.isEnabled(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY))
throw paramDeserializationContext.mappingException(this._collectionType.getRawClass());
JsonDeserializer localJsonDeserializer = this._valueDeserializer;
if (paramJsonParser.getCurrentToken() == JsonToken.VALUE_NULL)
{
localObject = null;
paramCollection.add(localObject);
return paramCollection;
}
if (localJsonDeserializer == null);
for (Object localObject = paramJsonParser.getText(); ; localObject = (String)localJsonDeserializer.deserialize(paramJsonParser, paramDeserializationContext))
break;
}
示例4: deserializeFromString
import org.codehaus.jackson.map.DeserializationContext; //导入方法依赖的package包/类
public Object deserializeFromString(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
if (this._stringCreator != null)
return this._stringCreator.construct(paramJsonParser.getText());
if (this._delegatingCreator != null)
return this._delegatingCreator.deserialize(paramJsonParser, paramDeserializationContext);
if ((paramDeserializationContext.isEnabled(DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)) && (paramJsonParser.getTextLength() == 0))
return null;
throw paramDeserializationContext.instantiationException(getBeanClass(), "no suitable creator method found to deserialize from JSON String");
}
示例5: wrapAndThrow
import org.codehaus.jackson.map.DeserializationContext; //导入方法依赖的package包/类
public void wrapAndThrow(Throwable paramThrowable, Object paramObject, int paramInt, DeserializationContext paramDeserializationContext)
throws IOException
{
while (((paramThrowable instanceof InvocationTargetException)) && (paramThrowable.getCause() != null))
paramThrowable = paramThrowable.getCause();
if ((paramThrowable instanceof Error))
throw ((Error)paramThrowable);
int i;
if ((paramDeserializationContext == null) || (paramDeserializationContext.isEnabled(DeserializationConfig.Feature.WRAP_EXCEPTIONS)))
i = 1;
while (true)
if ((paramThrowable instanceof IOException))
{
if ((i != 0) && ((paramThrowable instanceof JsonMappingException)))
break;
throw ((IOException)paramThrowable);
i = 0;
continue;
}
else
{
if ((i != 0) || (!(paramThrowable instanceof RuntimeException)))
break;
throw ((RuntimeException)paramThrowable);
}
throw JsonMappingException.wrapWithPath(paramThrowable, paramObject, paramInt);
}
示例6: wrapInstantiationProblem
import org.codehaus.jackson.map.DeserializationContext; //导入方法依赖的package包/类
protected void wrapInstantiationProblem(Throwable paramThrowable, DeserializationContext paramDeserializationContext)
throws IOException
{
while (((paramThrowable instanceof InvocationTargetException)) && (paramThrowable.getCause() != null))
paramThrowable = paramThrowable.getCause();
if ((paramThrowable instanceof Error))
throw ((Error)paramThrowable);
if ((paramDeserializationContext == null) || (paramDeserializationContext.isEnabled(DeserializationConfig.Feature.WRAP_EXCEPTIONS)));
for (int i = 1; (paramThrowable instanceof IOException); i = 0)
throw ((IOException)paramThrowable);
if ((i == 0) && ((paramThrowable instanceof RuntimeException)))
throw ((RuntimeException)paramThrowable);
throw paramDeserializationContext.instantiationException(this._beanType.getRawClass(), paramThrowable);
}
示例7: handleNonArray
import org.codehaus.jackson.map.DeserializationContext; //导入方法依赖的package包/类
private final Object[] handleNonArray(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
if (!paramDeserializationContext.isEnabled(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY))
{
if ((paramJsonParser.getCurrentToken() == JsonToken.VALUE_STRING) && (this._elementClass == Byte.class))
return deserializeFromBase64(paramJsonParser, paramDeserializationContext);
throw paramDeserializationContext.mappingException(this._arrayType.getRawClass());
}
Object localObject;
if (paramJsonParser.getCurrentToken() == JsonToken.VALUE_NULL)
{
localObject = null;
if (!this._untyped)
break label118;
}
label118: for (Object[] arrayOfObject = new Object[1]; ; arrayOfObject = (Object[])(Object[])Array.newInstance(this._elementClass, 1))
{
arrayOfObject[0] = localObject;
return arrayOfObject;
if (this._elementTypeDeserializer == null)
{
localObject = this._elementDeserializer.deserialize(paramJsonParser, paramDeserializationContext);
break;
}
localObject = this._elementDeserializer.deserializeWithType(paramJsonParser, paramDeserializationContext, this._elementTypeDeserializer);
break;
}
}
示例8: nullValue
import org.codehaus.jackson.map.DeserializationContext; //导入方法依赖的package包/类
public Object nullValue(DeserializationContext paramDeserializationContext)
throws JsonProcessingException
{
if ((this._isPrimitive) && (paramDeserializationContext.isEnabled(DeserializationConfig.Feature.FAIL_ON_NULL_FOR_PRIMITIVES)))
throw paramDeserializationContext.mappingException("Can not map JSON null into type " + this._rawType.getName() + " (set DeserializationConfig.Feature.FAIL_ON_NULL_FOR_PRIMITIVES to 'false' to allow)");
return this._nullValue;
}
示例9: handleNonArray
import org.codehaus.jackson.map.DeserializationContext; //导入方法依赖的package包/类
private final boolean[] handleNonArray(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
if (!paramDeserializationContext.isEnabled(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY))
throw paramDeserializationContext.mappingException(this._valueClass);
boolean[] arrayOfBoolean = new boolean[1];
arrayOfBoolean[0] = _parseBooleanPrimitive(paramJsonParser, paramDeserializationContext);
return arrayOfBoolean;
}
示例10: reportUnknownProperty
import org.codehaus.jackson.map.DeserializationContext; //导入方法依赖的package包/类
protected void reportUnknownProperty(DeserializationContext paramDeserializationContext, Object paramObject, String paramString)
throws IOException, JsonProcessingException
{
if (paramDeserializationContext.isEnabled(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES))
throw paramDeserializationContext.unknownFieldException(paramObject, paramString);
}
示例11: deserialize
import org.codehaus.jackson.map.DeserializationContext; //导入方法依赖的package包/类
public Number deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
JsonToken localJsonToken = paramJsonParser.getCurrentToken();
if (localJsonToken == JsonToken.VALUE_NUMBER_INT)
{
if (paramDeserializationContext.isEnabled(DeserializationConfig.Feature.USE_BIG_INTEGER_FOR_INTS))
return paramJsonParser.getBigIntegerValue();
return paramJsonParser.getNumberValue();
}
if (localJsonToken == JsonToken.VALUE_NUMBER_FLOAT)
{
if (paramDeserializationContext.isEnabled(DeserializationConfig.Feature.USE_BIG_DECIMAL_FOR_FLOATS))
return paramJsonParser.getDecimalValue();
return Double.valueOf(paramJsonParser.getDoubleValue());
}
if (localJsonToken == JsonToken.VALUE_STRING)
{
String str = paramJsonParser.getText().trim();
try
{
if (str.indexOf('.') < 0)
break label135;
if (paramDeserializationContext.isEnabled(DeserializationConfig.Feature.USE_BIG_DECIMAL_FOR_FLOATS))
{
BigDecimal localBigDecimal = new BigDecimal(str);
return localBigDecimal;
}
}
catch (IllegalArgumentException localIllegalArgumentException)
{
throw paramDeserializationContext.weirdStringException(this._valueClass, "not a valid number");
}
return new Double(str);
label135: if (paramDeserializationContext.isEnabled(DeserializationConfig.Feature.USE_BIG_INTEGER_FOR_INTS))
return new BigInteger(str);
long l = Long.parseLong(str);
if ((l <= 2147483647L) && (l >= -2147483648L))
return Integer.valueOf((int)l);
Long localLong = Long.valueOf(l);
return localLong;
}
throw paramDeserializationContext.mappingException(this._valueClass);
}