/** * Method that will construct a property object that represents * a logical property passed via Creator (constructor or static * factory method) */ protected SettableBeanProperty constructCreatorProperty(DeserializationConfig config, BasicBeanDescription beanDesc, String name, int index, AnnotatedParameter param) throws JsonMappingException { JavaType type = resolveType(config, beanDesc, param.getParameterType(), param); // Is there an annotation that specifies exact deserializer? JsonDeserializer<Object> deser = findDeserializerFromAnnotation(config, param); // If yes, we are mostly done: type = modifyTypeByAnnotation(config, param, type, name); TypeDeserializer typeDeser = findTypeDeserializer(config, type); SettableBeanProperty prop = new SettableBeanProperty.CreatorProperty(name, type, typeDeser, beanDesc.getBeanClass(), index); if (deser != null) { prop.setValueDeserializer(deser); } return prop; }
protected CreatorProperty constructCreatorProperty(DeserializationConfig paramDeserializationConfig, BasicBeanDescription paramBasicBeanDescription, String paramString, int paramInt, AnnotatedParameter paramAnnotatedParameter, Object paramObject) { JavaType localJavaType1 = paramDeserializationConfig.getTypeFactory().constructType(paramAnnotatedParameter.getParameterType(), paramBasicBeanDescription.bindingsForBeanType()); BeanProperty.Std localStd = new BeanProperty.Std(paramString, localJavaType1, paramBasicBeanDescription.getClassAnnotations(), paramAnnotatedParameter); JavaType localJavaType2 = resolveType(paramDeserializationConfig, paramBasicBeanDescription, localJavaType1, paramAnnotatedParameter, localStd); if (localJavaType2 != localJavaType1) localStd = localStd.withType(localJavaType2); JsonDeserializer localJsonDeserializer = findDeserializerFromAnnotation(paramDeserializationConfig, paramAnnotatedParameter, localStd); JavaType localJavaType3 = modifyTypeByAnnotation(paramDeserializationConfig, paramAnnotatedParameter, localJavaType2, paramString); TypeDeserializer localTypeDeserializer1 = (TypeDeserializer)localJavaType3.getTypeHandler(); if (localTypeDeserializer1 == null); for (TypeDeserializer localTypeDeserializer2 = findTypeDeserializer(paramDeserializationConfig, localJavaType3, localStd); ; localTypeDeserializer2 = localTypeDeserializer1) { CreatorProperty localCreatorProperty = new CreatorProperty(paramString, localJavaType3, localTypeDeserializer2, paramBasicBeanDescription.getClassAnnotations(), paramAnnotatedParameter, paramInt, paramObject); if (localJsonDeserializer != null) localCreatorProperty = localCreatorProperty.withValueDeserializer(localJsonDeserializer); return localCreatorProperty; } }
protected SettableBeanProperty constructCreatorProperty(DeserializationConfig paramDeserializationConfig, BasicBeanDescription paramBasicBeanDescription, String paramString, int paramInt, AnnotatedParameter paramAnnotatedParameter) throws JsonMappingException { JavaType localJavaType1 = paramDeserializationConfig.getTypeFactory().constructType(paramAnnotatedParameter.getParameterType(), paramBasicBeanDescription.bindingsForBeanType()); BeanProperty.Std localStd = new BeanProperty.Std(paramString, localJavaType1, paramBasicBeanDescription.getClassAnnotations(), paramAnnotatedParameter); JavaType localJavaType2 = resolveType(paramDeserializationConfig, paramBasicBeanDescription, localJavaType1, paramAnnotatedParameter, localStd); if (localJavaType2 != localJavaType1) localStd = localStd.withType(localJavaType2); JsonDeserializer localJsonDeserializer = findDeserializerFromAnnotation(paramDeserializationConfig, paramAnnotatedParameter, localStd); JavaType localJavaType3 = modifyTypeByAnnotation(paramDeserializationConfig, paramAnnotatedParameter, localJavaType2, paramString); SettableBeanProperty.CreatorProperty localCreatorProperty = new SettableBeanProperty.CreatorProperty(paramString, localJavaType3, findTypeDeserializer(paramDeserializationConfig, localJavaType3, localStd), paramBasicBeanDescription.getClassAnnotations(), paramAnnotatedParameter, paramInt); if (localJsonDeserializer != null) localCreatorProperty.setValueDeserializer(localJsonDeserializer); return localCreatorProperty; }
public String findPropertyNameForParam(AnnotatedParameter paramAnnotatedParameter) { String str = this._primary.findPropertyNameForParam(paramAnnotatedParameter); if (str == null) str = this._secondary.findPropertyNameForParam(paramAnnotatedParameter); return str; }
public CreatorProperty(String paramString, JavaType paramJavaType, TypeDeserializer paramTypeDeserializer, Annotations paramAnnotations, AnnotatedParameter paramAnnotatedParameter, int paramInt, Object paramObject) { super(paramString, paramJavaType, paramTypeDeserializer, paramAnnotations); this._annotated = paramAnnotatedParameter; this._propertyIndex = paramInt; this._injectableValueId = paramObject; }
protected void _addDeserializerFactoryMethods(DeserializationConfig paramDeserializationConfig, BasicBeanDescription paramBasicBeanDescription, VisibilityChecker<?> paramVisibilityChecker, AnnotationIntrospector paramAnnotationIntrospector, CreatorCollector paramCreatorCollector) { Iterator localIterator = paramBasicBeanDescription.getFactoryMethods().iterator(); while (localIterator.hasNext()) { AnnotatedMethod localAnnotatedMethod = (AnnotatedMethod)localIterator.next(); int i = localAnnotatedMethod.getParameterCount(); if (i > 0) { boolean bool = paramAnnotationIntrospector.hasCreatorAnnotation(localAnnotatedMethod); if (i == 1) { AnnotatedParameter localAnnotatedParameter2 = localAnnotatedMethod.getParameter(0); String str2 = paramAnnotationIntrospector.findPropertyNameForParam(localAnnotatedParameter2); if ((paramAnnotationIntrospector.findInjectableValueId(localAnnotatedParameter2) == null) && ((str2 == null) || (str2.length() == 0))) _handleSingleArgumentFactory(paramDeserializationConfig, paramBasicBeanDescription, paramVisibilityChecker, paramAnnotationIntrospector, paramCreatorCollector, localAnnotatedMethod, bool); } else if (paramAnnotationIntrospector.hasCreatorAnnotation(localAnnotatedMethod)) { CreatorProperty[] arrayOfCreatorProperty = new CreatorProperty[i]; for (int j = 0; j < i; j++) { AnnotatedParameter localAnnotatedParameter1 = localAnnotatedMethod.getParameter(j); String str1 = paramAnnotationIntrospector.findPropertyNameForParam(localAnnotatedParameter1); Object localObject = paramAnnotationIntrospector.findInjectableValueId(localAnnotatedParameter1); if (((str1 == null) || (str1.length() == 0)) && (localObject == null)) throw new IllegalArgumentException("Argument #" + j + " of factory method " + localAnnotatedMethod + " has no property name annotation; must have when multiple-paramater static method annotated as Creator"); arrayOfCreatorProperty[j] = constructCreatorProperty(paramDeserializationConfig, paramBasicBeanDescription, str1, j, localAnnotatedParameter1, localObject); } paramCreatorCollector.addPropertyCreator(localAnnotatedMethod, arrayOfCreatorProperty); } } } }
protected CreatorContainer findMapCreators(DeserializationConfig paramDeserializationConfig, BasicBeanDescription paramBasicBeanDescription) throws JsonMappingException { AnnotationIntrospector localAnnotationIntrospector = paramDeserializationConfig.getAnnotationIntrospector(); CreatorContainer localCreatorContainer = new CreatorContainer(paramBasicBeanDescription, paramDeserializationConfig.isEnabled(DeserializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS)); Iterator localIterator1 = paramBasicBeanDescription.getConstructors().iterator(); while (localIterator1.hasNext()) { AnnotatedConstructor localAnnotatedConstructor = (AnnotatedConstructor)localIterator1.next(); int m = localAnnotatedConstructor.getParameterCount(); if ((m < 1) || (!localAnnotationIntrospector.hasCreatorAnnotation(localAnnotatedConstructor))) continue; SettableBeanProperty[] arrayOfSettableBeanProperty2 = new SettableBeanProperty[m]; int n = 0; for (int i1 = 0; i1 < m; i1++) { AnnotatedParameter localAnnotatedParameter2 = localAnnotatedConstructor.getParameter(i1); if (localAnnotatedParameter2 == null); for (String str2 = null; (str2 == null) || (str2.length() == 0); str2 = localAnnotationIntrospector.findPropertyNameForParam(localAnnotatedParameter2)) throw new IllegalArgumentException("Parameter #" + i1 + " of constructor " + localAnnotatedConstructor + " has no property name annotation: must have for @JsonCreator for a Map type"); n++; arrayOfSettableBeanProperty2[i1] = constructCreatorProperty(paramDeserializationConfig, paramBasicBeanDescription, str2, i1, localAnnotatedParameter2); } localCreatorContainer.addPropertyConstructor(localAnnotatedConstructor, arrayOfSettableBeanProperty2); } Iterator localIterator2 = paramBasicBeanDescription.getFactoryMethods().iterator(); while (localIterator2.hasNext()) { AnnotatedMethod localAnnotatedMethod = (AnnotatedMethod)localIterator2.next(); int i = localAnnotatedMethod.getParameterCount(); if ((i < 1) || (!localAnnotationIntrospector.hasCreatorAnnotation(localAnnotatedMethod))) continue; SettableBeanProperty[] arrayOfSettableBeanProperty1 = new SettableBeanProperty[i]; int j = 0; for (int k = 0; k < i; k++) { AnnotatedParameter localAnnotatedParameter1 = localAnnotatedMethod.getParameter(k); if (localAnnotatedParameter1 == null); for (String str1 = null; (str1 == null) || (str1.length() == 0); str1 = localAnnotationIntrospector.findPropertyNameForParam(localAnnotatedParameter1)) throw new IllegalArgumentException("Parameter #" + k + " of factory method " + localAnnotatedMethod + " has no property name annotation: must have for @JsonCreator for a Map type"); j++; arrayOfSettableBeanProperty1[k] = constructCreatorProperty(paramDeserializationConfig, paramBasicBeanDescription, str1, k, localAnnotatedParameter1); } localCreatorContainer.addPropertyFactory(localAnnotatedMethod, arrayOfSettableBeanProperty1); } return localCreatorContainer; }
public CreatorProperty(String paramString, JavaType paramJavaType, TypeDeserializer paramTypeDeserializer, Annotations paramAnnotations, AnnotatedParameter paramAnnotatedParameter, int paramInt) { super(paramJavaType, paramTypeDeserializer, paramAnnotations); this._annotated = paramAnnotatedParameter; this._index = paramInt; }
protected void _addDeserializerFactoryMethods(DeserializationConfig paramDeserializationConfig, BasicBeanDescription paramBasicBeanDescription, VisibilityChecker<?> paramVisibilityChecker, AnnotationIntrospector paramAnnotationIntrospector, CreatorContainer paramCreatorContainer) throws JsonMappingException { Iterator localIterator = paramBasicBeanDescription.getFactoryMethods().iterator(); while (localIterator.hasNext()) { AnnotatedMethod localAnnotatedMethod = (AnnotatedMethod)localIterator.next(); int i = localAnnotatedMethod.getParameterCount(); if (i < 1) continue; boolean bool = paramAnnotationIntrospector.hasCreatorAnnotation(localAnnotatedMethod); if (i == 1) { String str2 = paramAnnotationIntrospector.findPropertyNameForParam(localAnnotatedMethod.getParameter(0)); if ((str2 == null) || (str2.length() == 0)) { Class localClass = localAnnotatedMethod.getParameterClass(0); if (localClass == String.class) { if ((!bool) && (!paramVisibilityChecker.isCreatorVisible(localAnnotatedMethod))) continue; paramCreatorContainer.addStringFactory(localAnnotatedMethod); continue; } if ((localClass == Integer.TYPE) || (localClass == Integer.class)) { if ((!bool) && (!paramVisibilityChecker.isCreatorVisible(localAnnotatedMethod))) continue; paramCreatorContainer.addIntFactory(localAnnotatedMethod); continue; } if ((localClass == Long.TYPE) || (localClass == Long.class)) { if ((!bool) && (!paramVisibilityChecker.isCreatorVisible(localAnnotatedMethod))) continue; paramCreatorContainer.addLongFactory(localAnnotatedMethod); continue; } if (!paramAnnotationIntrospector.hasCreatorAnnotation(localAnnotatedMethod)) continue; paramCreatorContainer.addDelegatingFactory(localAnnotatedMethod); continue; } } else { if (!paramAnnotationIntrospector.hasCreatorAnnotation(localAnnotatedMethod)) continue; } SettableBeanProperty[] arrayOfSettableBeanProperty = new SettableBeanProperty[i]; for (int j = 0; j < i; j++) { AnnotatedParameter localAnnotatedParameter = localAnnotatedMethod.getParameter(j); String str1 = paramAnnotationIntrospector.findPropertyNameForParam(localAnnotatedParameter); if ((str1 == null) || (str1.length() == 0)) throw new IllegalArgumentException("Argument #" + j + " of factory method " + localAnnotatedMethod + " has no property name annotation; must have when multiple-paramater static method annotated as Creator"); arrayOfSettableBeanProperty[j] = constructCreatorProperty(paramDeserializationConfig, paramBasicBeanDescription, str1, j, localAnnotatedParameter); } paramCreatorContainer.addPropertyFactory(localAnnotatedMethod, arrayOfSettableBeanProperty); } }
public String nameForConstructorParameter(MapperConfig<?> paramMapperConfig, AnnotatedParameter paramAnnotatedParameter, String paramString) { return translate(paramString); }
protected boolean _handleSingleArgumentConstructor(DeserializationConfig paramDeserializationConfig, BasicBeanDescription paramBasicBeanDescription, VisibilityChecker<?> paramVisibilityChecker, AnnotationIntrospector paramAnnotationIntrospector, CreatorCollector paramCreatorCollector, AnnotatedConstructor paramAnnotatedConstructor, boolean paramBoolean1, boolean paramBoolean2) { AnnotatedParameter localAnnotatedParameter = paramAnnotatedConstructor.getParameter(0); String str = paramAnnotationIntrospector.findPropertyNameForParam(localAnnotatedParameter); Object localObject = paramAnnotationIntrospector.findInjectableValueId(localAnnotatedParameter); if ((localObject != null) || ((str != null) && (str.length() > 0))) { CreatorProperty[] arrayOfCreatorProperty = new CreatorProperty[1]; arrayOfCreatorProperty[0] = constructCreatorProperty(paramDeserializationConfig, paramBasicBeanDescription, str, 0, localAnnotatedParameter, localObject); paramCreatorCollector.addPropertyCreator(paramAnnotatedConstructor, arrayOfCreatorProperty); return true; } Class localClass = paramAnnotatedConstructor.getParameterClass(0); if (localClass == String.class) { if ((paramBoolean1) || (paramBoolean2)) paramCreatorCollector.addStringCreator(paramAnnotatedConstructor); return true; } if ((localClass == Integer.TYPE) || (localClass == Integer.class)) { if ((paramBoolean1) || (paramBoolean2)) paramCreatorCollector.addIntCreator(paramAnnotatedConstructor); return true; } if ((localClass == Long.TYPE) || (localClass == Long.class)) { if ((paramBoolean1) || (paramBoolean2)) paramCreatorCollector.addLongCreator(paramAnnotatedConstructor); return true; } if ((localClass == Double.TYPE) || (localClass == Double.class)) { if ((paramBoolean1) || (paramBoolean2)) paramCreatorCollector.addDoubleCreator(paramAnnotatedConstructor); return true; } if (paramBoolean1) { paramCreatorCollector.addDelegatingCreator(paramAnnotatedConstructor); return true; } return false; }
public String nameForConstructorParameter(MapperConfig<?> paramMapperConfig, AnnotatedParameter paramAnnotatedParameter, String paramString) { return paramString; }
public abstract String findPropertyNameForParam(AnnotatedParameter paramAnnotatedParameter);