_addDeserializerFactoryMethods(ctxt, beanDesc, vchecker, intr, creators, creatorDefs);
protected void _addDeserializerFactoryMethods (DeserializationContext ctxt, BeanDescription beanDesc, VisibilityChecker<?> vchecker, AnnotationIntrospector intr, CreatorCollector creators, Map<AnnotatedWithParams,BeanPropertyDefinition[]> creatorParams) throws JsonMappingException { final DeserializationConfig config = ctxt.getConfig(); for (AnnotatedMethod factory : beanDesc.getFactoryMethods()) { final boolean isCreator = intr.hasCreatorAnnotation(factory); final int argCount = factory.getParameterCount(); // zero-arg methods must be annotated; if so, are "default creators" [JACKSON-850] if (argCount == 0) { if (isCreator) { creators.setDefaultCreator(factory); } continue; } final BeanPropertyDefinition[] propDefs = creatorParams.get(factory); // some single-arg factory methods (String, number) are auto-detected if (argCount == 1) { BeanPropertyDefinition argDef = (propDefs == null) ? null : propDefs[0]; boolean useProps = _checkIfCreatorPropertyBased(intr, factory, argDef); if (!useProps) { // not property based but delegating /*boolean added=*/ _handleSingleArgumentFactory(config, beanDesc, vchecker, intr, creators, factory, isCreator); // otherwise just ignored continue; } // fall through if there's name
protected void _addDeserializerFactoryMethods (DeserializationContext ctxt, BeanDescription beanDesc, VisibilityChecker<?> vchecker, AnnotationIntrospector intr, CreatorCollector creators, Map<AnnotatedWithParams,BeanPropertyDefinition[]> creatorParams) throws JsonMappingException { final DeserializationConfig config = ctxt.getConfig(); for (AnnotatedMethod factory : beanDesc.getFactoryMethods()) { final boolean isCreator = intr.hasCreatorAnnotation(factory); final int argCount = factory.getParameterCount(); // zero-arg methods must be annotated; if so, are "default creators" [JACKSON-850] if (argCount == 0) { if (isCreator) { creators.setDefaultCreator(factory); } continue; } final BeanPropertyDefinition[] propDefs = creatorParams.get(factory); // some single-arg factory methods (String, number) are auto-detected if (argCount == 1) { BeanPropertyDefinition argDef = (propDefs == null) ? null : propDefs[0]; boolean useProps = _checkIfCreatorPropertyBased(intr, factory, argDef); if (!useProps) { // not property based but delegating /*boolean added=*/ _handleSingleArgumentFactory(config, beanDesc, vchecker, intr, creators, factory, isCreator); // otherwise just ignored continue; } // fall through if there's name
/** * 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); }
_addDeserializerFactoryMethods(ctxt, beanDesc, vchecker, intr, creators, creatorDefs);
_addDeserializerFactoryMethods(ctxt, beanDesc, vchecker, intr, creators, creatorDefs);
_addDeserializerFactoryMethods(ctxt, beanDesc, vchecker, intr, creators, creatorDefs);
_addDeserializerFactoryMethods(ctxt, beanDesc, vchecker, intr, creators, creatorDefs);
_addDeserializerFactoryMethods(ctxt, beanDesc, vchecker, intr, creators); _addDeserializerConstructors(ctxt, beanDesc, vchecker, intr, creators);