_addDeserializerConstructors(ctxt, beanDesc, vchecker, intr, creators, creatorDefs);
/** * Method that will construct standard default {@link ValueInstantiator} * using annotations (like @JsonCreator) and visibility rules */ protected ValueInstantiator _constructDefaultValueInstantiator(DeserializationContext ctxt, BeanDescription beanDesc) throws JsonMappingException { boolean fixAccess = ctxt.canOverrideAccessModifiers(); CreatorCollector creators = new CreatorCollector(beanDesc, fixAccess); AnnotationIntrospector intr = ctxt.getAnnotationIntrospector(); // need to construct suitable visibility checker: final DeserializationConfig config = ctxt.getConfig(); VisibilityChecker<?> vchecker = config.getDefaultVisibilityChecker(); vchecker = intr.findAutoDetectVisibility(beanDesc.getClassInfo(), vchecker); /* Important: first add factory methods; then constructors, so * latter can override former! */ _addDeserializerFactoryMethods(ctxt, beanDesc, vchecker, intr, creators); // constructors only usable on concrete types: if (beanDesc.getType().isConcrete()) { _addDeserializerConstructors(ctxt, beanDesc, vchecker, intr, creators); } return creators.constructValueInstantiator(config); }
protected void _addDeserializerConstructors (DeserializationContext ctxt, BeanDescription beanDesc, VisibilityChecker<?> vchecker, AnnotationIntrospector intr, CreatorCollector creators, Map<AnnotatedWithParams,BeanPropertyDefinition[]> creatorParams) throws JsonMappingException { // First things first: the "default constructor" (zero-arg // constructor; whether implicit or explicit) is NOT included // in list of constructors, so needs to be handled separately. AnnotatedConstructor defaultCtor = beanDesc.findDefaultConstructor(); if (defaultCtor != null) { if (!creators.hasDefaultCreator() || intr.hasCreatorAnnotation(defaultCtor)) { creators.setDefaultCreator(defaultCtor); } } for (AnnotatedConstructor ctor : beanDesc.getConstructors()) { final boolean isCreator = intr.hasCreatorAnnotation(ctor); BeanPropertyDefinition[] propDefs = creatorParams.get(ctor); final int argCount = ctor.getParameterCount(); // some single-arg factory methods (String, number) are auto-detected if (argCount == 1) { BeanPropertyDefinition argDef = (propDefs == null) ? null : propDefs[0]; boolean useProps = _checkIfCreatorPropertyBased(intr, ctor, argDef); if (useProps) { CreatorProperty[] properties = new CreatorProperty[1]; PropertyName name = (argDef == null) ? null : argDef.getFullName(); AnnotatedParameter arg = ctor.getParameter(0); properties[0] = constructCreatorProperty(ctxt, beanDesc, name, 0, arg,
protected void _addDeserializerConstructors (DeserializationContext ctxt, BeanDescription beanDesc, VisibilityChecker<?> vchecker, AnnotationIntrospector intr, CreatorCollector creators, Map<AnnotatedWithParams,BeanPropertyDefinition[]> creatorParams) throws JsonMappingException { // First things first: the "default constructor" (zero-arg // constructor; whether implicit or explicit) is NOT included // in list of constructors, so needs to be handled separately. AnnotatedConstructor defaultCtor = beanDesc.findDefaultConstructor(); if (defaultCtor != null) { if (!creators.hasDefaultCreator() || intr.hasCreatorAnnotation(defaultCtor)) { creators.setDefaultCreator(defaultCtor); } } for (AnnotatedConstructor ctor : beanDesc.getConstructors()) { final boolean isCreator = intr.hasCreatorAnnotation(ctor); BeanPropertyDefinition[] propDefs = creatorParams.get(ctor); final int argCount = ctor.getParameterCount(); // some single-arg factory methods (String, number) are auto-detected if (argCount == 1) { BeanPropertyDefinition argDef = (propDefs == null) ? null : propDefs[0]; boolean useProps = _checkIfCreatorPropertyBased(intr, ctor, argDef); if (useProps) { CreatorProperty[] properties = new CreatorProperty[1]; PropertyName name = (argDef == null) ? null : argDef.getFullName(); AnnotatedParameter arg = ctor.getParameter(0); properties[0] = constructCreatorProperty(ctxt, beanDesc, name, 0, arg,
_addDeserializerConstructors(ctxt, beanDesc, vchecker, intr, creators, creatorDefs);
_addDeserializerConstructors(ctxt, beanDesc, vchecker, intr, creators, creatorDefs);
_addDeserializerConstructors(ctxt, beanDesc, vchecker, intr, creators, creatorDefs);
_addDeserializerConstructors(ctxt, beanDesc, vchecker, intr, creators, creatorDefs);
_addDeserializerConstructors(ctxt, beanDesc, vchecker, intr, creators);