本文整理汇总了Java中org.codehaus.jackson.map.DeserializationConfig.Feature类的典型用法代码示例。如果您正苦于以下问题:Java Feature类的具体用法?Java Feature怎么用?Java Feature使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Feature类属于org.codehaus.jackson.map.DeserializationConfig包,在下文中一共展示了Feature类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseResult
import org.codehaus.jackson.map.DeserializationConfig.Feature; //导入依赖的package包/类
private CallControlCallResultType parseResult(MultivaluedMap<String, String> queryParams, WebResource resource, boolean returnResult) throws JsonProcessingException, IOException {
queryParams.add("output", "json");
Builder builder = resource.queryParams(queryParams).getRequestBuilder();
builder = builder.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON);
builder = builder.type(javax.ws.rs.core.MediaType.APPLICATION_JSON);
builder = builder.cookie(JSESSIONID_WS);
String resultStr = builder.get(String.class);
ObjectMapper mapper = new ObjectMapper();
mapper.configure(Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
JsonNode rootNode = mapper.readTree(resultStr);
if(returnResult)
{
JsonNode ccr = rootNode.path("ExtActionResponse").path("structure").path("CallControlCallResult");
return mapper.readValue(ccr, CallControlCallResultType.class);
}
else return null;
}
示例2: handleNonArray
import org.codehaus.jackson.map.DeserializationConfig.Feature; //导入依赖的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);
}
}
示例3: deserialize
import org.codehaus.jackson.map.DeserializationConfig.Feature; //导入依赖的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());
}
示例4: handleNonArray
import org.codehaus.jackson.map.DeserializationConfig.Feature; //导入依赖的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;
}
示例5: constructAnySetter
import org.codehaus.jackson.map.DeserializationConfig.Feature; //导入依赖的package包/类
protected SettableAnyProperty constructAnySetter(DeserializationConfig paramDeserializationConfig, BasicBeanDescription paramBasicBeanDescription, AnnotatedMethod paramAnnotatedMethod)
throws JsonMappingException
{
if (paramDeserializationConfig.isEnabled(DeserializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS))
paramAnnotatedMethod.fixAccess();
JavaType localJavaType1 = paramBasicBeanDescription.bindingsForBeanType().resolveType(paramAnnotatedMethod.getParameterType(1));
BeanProperty.Std localStd = new BeanProperty.Std(paramAnnotatedMethod.getName(), localJavaType1, paramBasicBeanDescription.getClassAnnotations(), paramAnnotatedMethod);
JavaType localJavaType2 = resolveType(paramDeserializationConfig, paramBasicBeanDescription, localJavaType1, paramAnnotatedMethod, localStd);
JsonDeserializer localJsonDeserializer = findDeserializerFromAnnotation(paramDeserializationConfig, paramAnnotatedMethod, localStd);
if (localJsonDeserializer != null)
{
SettableAnyProperty localSettableAnyProperty = new SettableAnyProperty(localStd, paramAnnotatedMethod, localJavaType2);
localSettableAnyProperty.setValueDeserializer(localJsonDeserializer);
return localSettableAnyProperty;
}
return new SettableAnyProperty(localStd, paramAnnotatedMethod, modifyTypeByAnnotation(paramDeserializationConfig, paramAnnotatedMethod, localJavaType2, localStd.getName()));
}
示例6: constructSettableProperty
import org.codehaus.jackson.map.DeserializationConfig.Feature; //导入依赖的package包/类
protected SettableBeanProperty constructSettableProperty(DeserializationConfig paramDeserializationConfig, BasicBeanDescription paramBasicBeanDescription, String paramString, AnnotatedField paramAnnotatedField)
throws JsonMappingException
{
if (paramDeserializationConfig.isEnabled(DeserializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS))
paramAnnotatedField.fixAccess();
JavaType localJavaType1 = paramBasicBeanDescription.bindingsForBeanType().resolveType(paramAnnotatedField.getGenericType());
BeanProperty.Std localStd = new BeanProperty.Std(paramString, localJavaType1, paramBasicBeanDescription.getClassAnnotations(), paramAnnotatedField);
JavaType localJavaType2 = resolveType(paramDeserializationConfig, paramBasicBeanDescription, localJavaType1, paramAnnotatedField, localStd);
if (localJavaType2 != localJavaType1)
localStd = localStd.withType(localJavaType2);
JsonDeserializer localJsonDeserializer = findDeserializerFromAnnotation(paramDeserializationConfig, paramAnnotatedField, localStd);
JavaType localJavaType3 = modifyTypeByAnnotation(paramDeserializationConfig, paramAnnotatedField, localJavaType2, paramString);
SettableBeanProperty.FieldProperty localFieldProperty = new SettableBeanProperty.FieldProperty(paramString, localJavaType3, (TypeDeserializer)localJavaType3.getTypeHandler(), paramBasicBeanDescription.getClassAnnotations(), paramAnnotatedField);
if (localJsonDeserializer != null)
localFieldProperty.setValueDeserializer(localJsonDeserializer);
AnnotationIntrospector.ReferenceProperty localReferenceProperty = paramDeserializationConfig.getAnnotationIntrospector().findReferenceType(paramAnnotatedField);
if ((localReferenceProperty != null) && (localReferenceProperty.isManagedReference()))
localFieldProperty.setManagedReferenceName(localReferenceProperty.getName());
return localFieldProperty;
}
示例7: findDeserializerCreators
import org.codehaus.jackson.map.DeserializationConfig.Feature; //导入依赖的package包/类
protected CreatorContainer findDeserializerCreators(DeserializationConfig paramDeserializationConfig, BasicBeanDescription paramBasicBeanDescription)
throws JsonMappingException
{
boolean bool = paramDeserializationConfig.isEnabled(DeserializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS);
CreatorContainer localCreatorContainer = new CreatorContainer(paramBasicBeanDescription, bool);
AnnotationIntrospector localAnnotationIntrospector = paramDeserializationConfig.getAnnotationIntrospector();
if (paramBasicBeanDescription.getType().isConcrete())
{
Constructor localConstructor = paramBasicBeanDescription.findDefaultConstructor();
if (localConstructor != null)
{
if (bool)
ClassUtil.checkAndFixAccess(localConstructor);
localCreatorContainer.setDefaultConstructor(localConstructor);
}
}
VisibilityChecker localVisibilityChecker1 = paramDeserializationConfig.getDefaultVisibilityChecker();
if (!paramDeserializationConfig.isEnabled(DeserializationConfig.Feature.AUTO_DETECT_CREATORS))
localVisibilityChecker1 = localVisibilityChecker1.withCreatorVisibility(JsonAutoDetect.Visibility.NONE);
VisibilityChecker localVisibilityChecker2 = paramDeserializationConfig.getAnnotationIntrospector().findAutoDetectVisibility(paramBasicBeanDescription.getClassInfo(), localVisibilityChecker1);
_addDeserializerConstructors(paramDeserializationConfig, paramBasicBeanDescription, localVisibilityChecker2, localAnnotationIntrospector, localCreatorContainer);
_addDeserializerFactoryMethods(paramDeserializationConfig, paramBasicBeanDescription, localVisibilityChecker2, localAnnotationIntrospector, localCreatorContainer);
return localCreatorContainer;
}
示例8: readCityList
import org.codehaus.jackson.map.DeserializationConfig.Feature; //导入依赖的package包/类
public static CityListCityModel[] readCityList()
{
List<CityListCityModel> list = new ArrayList<CityListCityModel>();
CityListCityModel cities[];
String json = readAssertsFile("city.json", IndexListviewApplication.getContext());
try {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
JavaType javaType = mapper.getTypeFactory().constructParametricType(ArrayList.class, CityListCityModel.class);
list = mapper.readValue(json.toString(), javaType);
} catch (Exception e) {
e.printStackTrace();
}
cities = list.toArray(new CityListCityModel[list.size()]);
return cities;
}
示例9: deserialize
import org.codehaus.jackson.map.DeserializationConfig.Feature; //导入依赖的package包/类
@Override
public List<Map<Term, String>> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
if (jp.getCurrentToken() == JsonToken.START_ARRAY) {
JsonDeserializer<Object> deserializer =
ctxt.getDeserializerProvider().findTypedValueDeserializer(ctxt.getConfig(),
ctxt.constructType(List.class),null);
List<Map<String, String>> verbatimTerms = (List<Map<String, String>>) deserializer.deserialize(jp, ctxt);
List<Map<Term, String>> interpretedTerms = Lists.newArrayList();
for (Map<String, String> verbExtension : verbatimTerms) {
Map<Term, String> extension = new HashMap<Term, String>();
for (Entry<String, String> entry : verbExtension.entrySet()) {
Term term = termFactory.findTerm(entry.getKey());
if (term == null && ctxt.getConfig().isEnabled(Feature.FAIL_ON_UNKNOWN_PROPERTIES)) {
throw ctxt.mappingException("Term not found " + entry.getKey());
}
extension.put(term, entry.getValue());
}
interpretedTerms.add(extension);
}
return interpretedTerms;
}
throw ctxt.mappingException("Expected JSON String");
}
示例10: wrapAndThrow
import org.codehaus.jackson.map.DeserializationConfig.Feature; //导入依赖的package包/类
public void wrapAndThrow(Throwable paramThrowable, Object paramObject, String paramString, DeserializationContext paramDeserializationContext)
{
for (Throwable localThrowable = paramThrowable; ((localThrowable instanceof InvocationTargetException)) && (localThrowable.getCause() != null); localThrowable = localThrowable.getCause());
if ((localThrowable instanceof Error))
throw ((Error)localThrowable);
if ((paramDeserializationContext == null) || (paramDeserializationContext.isEnabled(DeserializationConfig.Feature.WRAP_EXCEPTIONS)));
for (int i = 1; (localThrowable instanceof IOException); i = 0)
{
if ((i != 0) && ((localThrowable instanceof JsonMappingException)))
break label114;
throw ((IOException)localThrowable);
}
if ((i == 0) && ((localThrowable instanceof RuntimeException)))
throw ((RuntimeException)localThrowable);
label114: throw JsonMappingException.wrapWithPath(localThrowable, paramObject, paramString);
}
示例11: handleNonArray
import org.codehaus.jackson.map.DeserializationConfig.Feature; //导入依赖的package包/类
private final Collection<String> handleNonArray(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext, Collection<String> paramCollection)
{
if (!paramDeserializationContext.isEnabled(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY))
throw paramDeserializationContext.mappingException(this._collectionType.getRawClass());
JsonDeserializer localJsonDeserializer = this._valueDeserializer;
Object localObject;
if (paramJsonParser.getCurrentToken() == JsonToken.VALUE_NULL)
localObject = null;
while (true)
{
paramCollection.add(localObject);
return paramCollection;
if (localJsonDeserializer == null)
localObject = paramJsonParser.getText();
else
localObject = (String)localJsonDeserializer.deserialize(paramJsonParser, paramDeserializationContext);
}
}
示例12: handleNonArray
import org.codehaus.jackson.map.DeserializationConfig.Feature; //导入依赖的package包/类
private final Collection<Object> handleNonArray(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext, Collection<Object> paramCollection)
{
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);
else
localObject = localJsonDeserializer.deserializeWithType(paramJsonParser, paramDeserializationContext, localTypeDeserializer);
}
}
示例13: handleNonArray
import org.codehaus.jackson.map.DeserializationConfig.Feature; //导入依赖的package包/类
private final String[] handleNonArray(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
{
if (!paramDeserializationContext.isEnabled(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY))
{
if ((paramJsonParser.getCurrentToken() == JsonToken.VALUE_STRING) && (paramDeserializationContext.isEnabled(DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)) && (paramJsonParser.getText().length() == 0))
return null;
throw paramDeserializationContext.mappingException(this._valueClass);
}
String[] arrayOfString = new String[1];
JsonToken localJsonToken1 = paramJsonParser.getCurrentToken();
JsonToken localJsonToken2 = JsonToken.VALUE_NULL;
String str = null;
if (localJsonToken1 == localJsonToken2);
while (true)
{
arrayOfString[0] = str;
return arrayOfString;
str = paramJsonParser.getText();
}
}
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:21,代码来源:PrimitiveArrayDeserializers$StringDeser.java
示例14: mapArray
import org.codehaus.jackson.map.DeserializationConfig.Feature; //导入依赖的package包/类
protected Object mapArray(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
{
if (paramDeserializationContext.isEnabled(DeserializationConfig.Feature.USE_JAVA_ARRAY_FOR_JSON_ARRAY))
return mapArrayToArray(paramJsonParser, paramDeserializationContext);
if (paramJsonParser.nextToken() == JsonToken.END_ARRAY)
return new ArrayList(4);
ObjectBuffer localObjectBuffer = paramDeserializationContext.leaseObjectBuffer();
Object[] arrayOfObject1 = localObjectBuffer.resetAndStart();
int i = 0;
Object[] arrayOfObject2 = arrayOfObject1;
int j = 0;
Object localObject = deserialize(paramJsonParser, paramDeserializationContext);
j++;
if (i >= arrayOfObject2.length)
arrayOfObject2 = localObjectBuffer.appendCompletedChunk(arrayOfObject2);
for (int k = 0; ; k = i)
{
i = k + 1;
arrayOfObject2[k] = localObject;
if (paramJsonParser.nextToken() != JsonToken.END_ARRAY)
break;
ArrayList localArrayList = new ArrayList(1 + (j + (j >> 3)));
localObjectBuffer.completeAndClearBuffer(arrayOfObject2, i, localArrayList);
return localArrayList;
}
}
示例15: deserialize
import org.codehaus.jackson.map.DeserializationConfig.Feature; //导入依赖的package包/类
public Enum<?> deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
{
JsonToken localJsonToken = paramJsonParser.getCurrentToken();
Enum localEnum;
if (localJsonToken == JsonToken.VALUE_STRING)
{
String str = paramJsonParser.getText();
localEnum = this._resolver.findEnum(str);
if (localEnum == null)
throw paramDeserializationContext.weirdStringException(this._resolver.getEnumClass(), "value not one of declared Enum instance names");
}
else 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();
localEnum = this._resolver.getEnum(i);
if (localEnum == null)
throw paramDeserializationContext.weirdNumberException(this._resolver.getEnumClass(), "index value outside legal index range [0.." + this._resolver.lastValidIndex() + "]");
}
else
{
throw paramDeserializationContext.mappingException(this._resolver.getEnumClass());
}
return localEnum;
}