public void addPropertyCreator(AnnotatedWithParams paramAnnotatedWithParams, CreatorProperty[] paramArrayOfCreatorProperty) { this._propertyBasedCreator = verifyNonDup(paramAnnotatedWithParams, this._propertyBasedCreator, "property-based"); if (paramArrayOfCreatorProperty.length > 1) { HashMap localHashMap = new HashMap(); int i = 0; int j = paramArrayOfCreatorProperty.length; while (i < j) { String str = paramArrayOfCreatorProperty[i].getName(); if ((str.length() != 0) || (paramArrayOfCreatorProperty[i].getInjectableValueId() == null)) { Integer localInteger = (Integer)localHashMap.put(str, Integer.valueOf(i)); if (localInteger != null) throw new IllegalArgumentException("Duplicate creator property \"" + str + "\" (index " + localInteger + " vs " + i + ")"); } i++; } } this._propertyBasedArgs = paramArrayOfCreatorProperty; }
private static boolean hasAnnotationOrParameterAnnotation(AnnotatedWithParams annotatedWithParams) { return hasAnnotation(annotatedWithParams.annotations()) || IntStream.range(0, annotatedWithParams.getParameterCount()) .mapToObj(index -> annotatedWithParams.getParameterAnnotations(index)) .reduce(false, (acc, annotationMap) -> acc | hasAnnotation(annotationMap), (acc1, acc2) -> acc1 | acc2); }
public ValueInstantiator findValueInstantiator(DeserializationContext paramDeserializationContext, BeanDescription paramBeanDescription) { DeserializationConfig localDeserializationConfig = paramDeserializationContext.getConfig(); AnnotatedClass localAnnotatedClass = paramBeanDescription.getClassInfo(); Object localObject1 = paramDeserializationContext.getAnnotationIntrospector().findValueInstantiator(localAnnotatedClass); Object localObject2 = null; if (localObject1 != null) localObject2 = _valueInstantiatorInstance(localDeserializationConfig, localAnnotatedClass, localObject1); if (localObject2 == null) { ValueInstantiator localValueInstantiator2 = _findStdValueInstantiator(localDeserializationConfig, paramBeanDescription); localObject2 = localValueInstantiator2; if (localValueInstantiator2 == null) localObject2 = _constructDefaultValueInstantiator(paramDeserializationContext, paramBeanDescription); } if (this._factoryConfig.hasValueInstantiators()) { Iterator localIterator = this._factoryConfig.valueInstantiators().iterator(); while (localIterator.hasNext()) { ValueInstantiators localValueInstantiators = (ValueInstantiators)localIterator.next(); ValueInstantiator localValueInstantiator1 = localValueInstantiators.findValueInstantiator(localDeserializationConfig, paramBeanDescription, (ValueInstantiator)localObject2); localObject2 = localValueInstantiator1; if (localValueInstantiator1 == null) throw new JsonMappingException("Broken registered ValueInstantiators (of type " + localValueInstantiators.getClass().getName() + "): returned null ValueInstantiator"); } } if (((ValueInstantiator)localObject2).getIncompleteParameter() != null) { AnnotatedParameter localAnnotatedParameter = ((ValueInstantiator)localObject2).getIncompleteParameter(); AnnotatedWithParams localAnnotatedWithParams = localAnnotatedParameter.getOwner(); throw new IllegalArgumentException("Argument #" + localAnnotatedParameter.getIndex() + " of constructor " + localAnnotatedWithParams + " has no property name annotation; must have name when multiple-paramater constructor annotated as Creator"); } return localObject2; }
public final JsonDeserializer<?> createContextual(DeserializationContext paramDeserializationContext, BeanProperty paramBeanProperty) { ValueInstantiator localValueInstantiator = this._valueInstantiator; JsonDeserializer localJsonDeserializer1 = null; if (localValueInstantiator != null) { AnnotatedWithParams localAnnotatedWithParams = this._valueInstantiator.getDelegateCreator(); localJsonDeserializer1 = null; if (localAnnotatedWithParams != null) localJsonDeserializer1 = findDeserializer(paramDeserializationContext, this._valueInstantiator.getDelegateType(paramDeserializationContext.getConfig()), paramBeanProperty); } JsonDeserializer localJsonDeserializer2 = this._valueDeserializer; Object localObject = localJsonDeserializer2; if (localJsonDeserializer2 == null) { JsonDeserializer localJsonDeserializer3 = findConvertingContentDeserializer(paramDeserializationContext, paramBeanProperty, (JsonDeserializer)localObject); localObject = localJsonDeserializer3; if (localJsonDeserializer3 == null) localObject = paramDeserializationContext.findContextualValueDeserializer(this._collectionType.getContentType(), paramBeanProperty); } else if ((localObject instanceof ContextualDeserializer)) { localObject = ((ContextualDeserializer)localObject).createContextual(paramDeserializationContext, paramBeanProperty); } if (isDefaultDeserializer((JsonDeserializer)localObject)) localObject = null; return withResolved(localJsonDeserializer1, (JsonDeserializer)localObject); }
public void configureFromObjectSettings(AnnotatedWithParams paramAnnotatedWithParams1, AnnotatedWithParams paramAnnotatedWithParams2, JavaType paramJavaType, CreatorProperty[] paramArrayOfCreatorProperty1, AnnotatedWithParams paramAnnotatedWithParams3, CreatorProperty[] paramArrayOfCreatorProperty2) { this._defaultCreator = paramAnnotatedWithParams1; this._delegateCreator = paramAnnotatedWithParams2; this._delegateType = paramJavaType; this._delegateArguments = paramArrayOfCreatorProperty1; this._withArgsCreator = paramAnnotatedWithParams3; this._constructorArguments = paramArrayOfCreatorProperty2; }
public void setDefaultCreator(AnnotatedWithParams paramAnnotatedWithParams) { if ((paramAnnotatedWithParams instanceof AnnotatedConstructor)) { setDefaultConstructor((AnnotatedConstructor)paramAnnotatedWithParams); return; } this._defaultConstructor = ((AnnotatedWithParams)_fixAccess(paramAnnotatedWithParams)); }
@SuppressWarnings("unchecked") public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { // May need to resolve types for delegate-based creators: JsonDeserializer<Object> delegate = null; if (_valueInstantiator != null) { AnnotatedWithParams delegateCreator = _valueInstantiator.getDelegateCreator(); if (delegateCreator != null) { JavaType delegateType = _valueInstantiator.getDelegateType(ctxt.getConfig()); delegate = findDeserializer(ctxt, delegateType, property); } } JsonDeserializer<?> valueDeser = _valueDeserializer; if (valueDeser == null) { // And we may also need to get deserializer for String JsonDeserializer<?> deser = ctxt.findContextualValueDeserializer( _collectionType.getContentType(), property); valueDeser = (JsonDeserializer<String>) deser; } else { // if directly assigned, probably not yet contextual, so: if (valueDeser instanceof ContextualDeserializer) { valueDeser = ((ContextualDeserializer) valueDeser).createContextual(ctxt, property); } } if (isDefaultDeserializer(valueDeser)) { valueDeser = null; } return withResolved(delegate, valueDeser); }
/** * Method for setting properties related to instantiating values * from JSON Object. We will choose basically only one approach (out of possible * three), and clear other properties */ public void configureFromObjectSettings(AnnotatedWithParams defaultCreator, AnnotatedWithParams delegateCreator, JavaType delegateType, CreatorProperty[] delegateArgs, AnnotatedWithParams withArgsCreator, CreatorProperty[] constructorArgs) { _defaultCreator = defaultCreator; _delegateCreator = delegateCreator; _delegateType = delegateType; _delegateArguments = delegateArgs; _withArgsCreator = withArgsCreator; _constructorArguments = constructorArgs; }
private static void logParameters(StringBuilder sb, AnnotatedWithParams annotatedWithParams) { IntStream.range(0, annotatedWithParams.getParameterCount()) .filter(index -> hasAnnotation(annotatedWithParams.getParameterAnnotations(index))) .forEach(index -> sb.append(" > p" + index + ": " + annotationsItToStr(annotatedWithParams.getParameterAnnotations(index))) .append(ln)); }
public void configureFromBooleanCreator(AnnotatedWithParams paramAnnotatedWithParams) { this._fromBooleanCreator = paramAnnotatedWithParams; }
public void configureFromDoubleCreator(AnnotatedWithParams paramAnnotatedWithParams) { this._fromDoubleCreator = paramAnnotatedWithParams; }
public void configureFromIntCreator(AnnotatedWithParams paramAnnotatedWithParams) { this._fromIntCreator = paramAnnotatedWithParams; }
public void configureFromLongCreator(AnnotatedWithParams paramAnnotatedWithParams) { this._fromLongCreator = paramAnnotatedWithParams; }
public void configureFromStringCreator(AnnotatedWithParams paramAnnotatedWithParams) { this._fromStringCreator = paramAnnotatedWithParams; }
public AnnotatedWithParams getDefaultCreator() { return this._defaultCreator; }
public AnnotatedWithParams getDelegateCreator() { return this._delegateCreator; }
public AnnotatedWithParams getWithArgsCreator() { return this._withArgsCreator; }
public void addBooleanCreator(AnnotatedWithParams paramAnnotatedWithParams) { this._booleanCreator = verifyNonDup(paramAnnotatedWithParams, this._booleanCreator, "boolean"); }
public void addDelegatingCreator(AnnotatedWithParams paramAnnotatedWithParams, CreatorProperty[] paramArrayOfCreatorProperty) { this._delegateCreator = verifyNonDup(paramAnnotatedWithParams, this._delegateCreator, "delegate"); this._delegateArgs = paramArrayOfCreatorProperty; }
public void addDoubleCreator(AnnotatedWithParams paramAnnotatedWithParams) { this._doubleCreator = verifyNonDup(paramAnnotatedWithParams, this._doubleCreator, "double"); }
public void addIntCreator(AnnotatedWithParams paramAnnotatedWithParams) { this._intCreator = verifyNonDup(paramAnnotatedWithParams, this._intCreator, "int"); }
public void addLongCreator(AnnotatedWithParams paramAnnotatedWithParams) { this._longCreator = verifyNonDup(paramAnnotatedWithParams, this._longCreator, "long"); }
public void addStringCreator(AnnotatedWithParams paramAnnotatedWithParams) { this._stringCreator = verifyNonDup(paramAnnotatedWithParams, this._stringCreator, "String"); }
@Deprecated public void setDefaultConstructor(AnnotatedConstructor paramAnnotatedConstructor) { this._defaultConstructor = ((AnnotatedWithParams)_fixAccess(paramAnnotatedConstructor)); }
protected AnnotatedWithParams verifyNonDup(AnnotatedWithParams paramAnnotatedWithParams1, AnnotatedWithParams paramAnnotatedWithParams2, String paramString) { if ((paramAnnotatedWithParams2 != null) && (paramAnnotatedWithParams2.getClass() == paramAnnotatedWithParams1.getClass())) throw new IllegalArgumentException("Conflicting " + paramString + " creators: already had " + paramAnnotatedWithParams2 + ", encountered " + paramAnnotatedWithParams1); return (AnnotatedWithParams)_fixAccess(paramAnnotatedWithParams1); }
public AnnotatedWithParams getDefaultCreator() { return null; }
public AnnotatedWithParams getDelegateCreator() { return null; }
public AnnotatedWithParams getWithArgsCreator() { return null; }
public void configureFromStringCreator(AnnotatedWithParams creator) { _fromStringCreator = creator; }
public void configureFromIntCreator(AnnotatedWithParams creator) { _fromIntCreator = creator; }
public void configureFromLongCreator(AnnotatedWithParams creator) { _fromLongCreator = creator; }
public void configureFromDoubleCreator(AnnotatedWithParams creator) { _fromDoubleCreator = creator; }
public void configureFromBooleanCreator(AnnotatedWithParams creator) { _fromBooleanCreator = creator; }
@Override public AnnotatedWithParams getDelegateCreator() { return _delegateCreator; }
@Override public AnnotatedWithParams getDefaultCreator() { return _defaultCreator; }
@Override public AnnotatedWithParams getWithArgsCreator() { return _withArgsCreator; }
/** * Method that can be called to try to access member (constructor, * static factory method) that is used as the "default creator" * (creator that is called without arguments; typically default * [zero-argument] constructor of the type). * Note that implementations not required to return actual object * they use (or, they may use some other instantiation) method. * That is, even if {@link #canCreateUsingDefault()} returns true, * this method may return null . */ public AnnotatedWithParams getDefaultCreator() { return null; }
/** * Method that can be called to try to access member (constructor, * static factory method) that is used as the "delegate creator". * Note that implementations not required to return actual object * they use (or, they may use some other instantiation) method. * That is, even if {@link #canCreateUsingDelegate()} returns true, * this method may return null . */ public AnnotatedWithParams getDelegateCreator() { return null; }
/** * Method that can be called to try to access member (constructor, * static factory method) that is used as the "non-default creator" * (constructor or factory method that takes one or more arguments). * Note that implementations not required to return actual object * they use (or, they may use some other instantiation) method. * That is, even if {@link #canCreateFromObjectWith()} returns true, * this method may return null . */ public AnnotatedWithParams getWithArgsCreator() { return null; }