Package com.fasterxml.jackson.databind.deser

Examples of com.fasterxml.jackson.databind.deser.BeanDeserializerBase


        if (!aliasDefaults.isEmpty()) {
            if (deserializer instanceof DelegatingDeserializer) {
                deserializer = ((DelegatingDeserializer) deserializer).getDelegatee();
            }
            if ((deserializer instanceof BeanDeserializerBase) && (aliasDefaults.get("_primary") != null)) {
                BeanDeserializerBase beanDeserializer = (BeanDeserializerBase) deserializer;
                String primaryField = (String) aliasDefaults.get("_primary").unwrapped();
                if (!fieldValues.has(primaryField)) {
                    // user has not explicitly set a value where _primary points, see if _primary is a plugin type
                    SettableBeanProperty primaryProperty = beanDeserializer.findProperty(primaryField);
                    if ((primaryProperty != null) && primaryProperty.hasValueTypeDeserializer()) {
                        TypeDeserializer primaryTypeDeserializer = primaryProperty.getValueTypeDeserializer();
                        if (primaryTypeDeserializer instanceof CodecTypeDeserializer) {
                            CodecTypeIdResolver primaryPropertyTypeIdResolver =
                                    ((CodecTypeDeserializer) primaryTypeDeserializer).idRes;
                            String possibleInlinedPrimary = null;
                            Iterator<String> fieldNames = fieldValues.fieldNames();
                            while (fieldNames.hasNext()) {
                                String fieldName = fieldNames.next();
                                if ((fieldName.charAt(0) != '_') && !beanDeserializer.hasProperty(fieldName)) {
                                    if (primaryPropertyTypeIdResolver.isValidTypeId(fieldName)) {
                                        if (possibleInlinedPrimary == null) {
                                            possibleInlinedPrimary = fieldName;
                                        } else {
                                            String message = String.format(
                                                    "%s and %s are both otherwise unknown properties that "
                                                    + "could be types for the _primary property %s whose category is "
                                                    + "%s. This is too ambiguous to resolve.",
                                                    possibleInlinedPrimary, fieldName, primaryField,
                                                    ((CodecTypeDeserializer) primaryTypeDeserializer)
                                                            .pluginMap.category());
                                            JsonMappingException ex =
                                                    ctxt.instantiationException(_baseType.getRawClass(), message);
                                            ex.prependPath(beanDeserializer.getValueType(), fieldName);
                                            throw ex;
                                        }
                                    }
                                }
                            }
View Full Code Here


        if (deserializer instanceof DelegatingDeserializer) {
            JsonDeserializer<?> delegatee = ((DelegatingDeserializer) deserializer).getDelegatee();
            JsonDeserializer<?> replacementDelegatee = modifyDeserializer(config, beanDesc, delegatee);
            return deserializer.replaceDelegatee(replacementDelegatee);
        } else if (deserializer instanceof BeanDeserializerBase) {
            BeanDeserializerBase beanDeserializer = (BeanDeserializerBasedeserializer;
            ObjectNode fieldDefaults = config.getNodeFactory().objectNode();
            Iterator<SettableBeanProperty> propertyIterator = beanDeserializer.properties();
            while (propertyIterator.hasNext()) {
                SettableBeanProperty prop = propertyIterator.next();
                Class<?> declaringClass = prop.getMember().getDeclaringClass();
                String canonicalClassName = declaringClass.getCanonicalName();
                if ((canonicalClassName != null) && globalDefaults.hasPath(canonicalClassName)) {
View Full Code Here

                                                     ConfigObject aliasDefaults,
                                                     JsonDeserializer<?> deserializer,
                                                     DeserializationContext ctxt) throws JsonMappingException {
        if (!aliasDefaults.isEmpty()) {
            if ((deserializer instanceof BeanDeserializerBase) && (aliasDefaults.get("_primary") != null)) {
                BeanDeserializerBase beanDeserializer = (BeanDeserializerBase) deserializer;
                String primaryField = (String) aliasDefaults.get("_primary").unwrapped();
                if (!fieldValues.has(primaryField)) {
                    // user has not explicitly set a value where _primary points, see if _primary is a plugin type
                    SettableBeanProperty primaryProperty = beanDeserializer.findProperty(primaryField);
                    if ((primaryProperty != null) && primaryProperty.hasValueTypeDeserializer()) {
                        TypeDeserializer primaryTypeDeserializer = primaryProperty.getValueTypeDeserializer();
                        if (primaryTypeDeserializer instanceof CodecTypeDeserializer) {
                            CodecTypeIdResolver primaryPropertyTypeIdResolver =
                                    ((CodecTypeDeserializer) primaryTypeDeserializer).idRes;
                            String possibleInlinedPrimary = null;
                            Iterator<String> fieldNames = fieldValues.fieldNames();
                            while (fieldNames.hasNext()) {
                                String fieldName = fieldNames.next();
                                if ((fieldName.charAt(0) != '_') && !beanDeserializer.hasProperty(fieldName)) {
                                    if (primaryPropertyTypeIdResolver.isValidTypeId(fieldName)) {
                                        if (possibleInlinedPrimary == null) {
                                            possibleInlinedPrimary = fieldName;
                                        } else {
                                            String message = String.format(
                                                    "%s and %s are both otherwise unknown properties that "
                                                    + "could be types for the _primary property %s whose category is "
                                                    + "%s. This is too ambiguous to resolve.",
                                                    possibleInlinedPrimary, fieldName, primaryField,
                                                    ((CodecTypeDeserializer) primaryTypeDeserializer)
                                                            .pluginMap.category());
                                            JsonMappingException ex =
                                                    ctxt.instantiationException(_baseType.getRawClass(), message);
                                            ex.prependPath(beanDeserializer.getValueType(), fieldName);
                                            throw ex;
                                        }
                                    }
                                }
                            }
View Full Code Here

    @Override public JsonDeserializer<?> modifyDeserializer(DeserializationConfig config,
                                                            BeanDescription beanDesc,
                                                            JsonDeserializer<?> deserializer) {
        if (deserializer instanceof BeanDeserializerBase) {
            BeanDeserializerBase beanDeserializer = (BeanDeserializerBasedeserializer;
            ObjectNode fieldDefaults = config.getNodeFactory().objectNode();
            Iterator<SettableBeanProperty> propertyIterator = beanDeserializer.properties();
            while (propertyIterator.hasNext()) {
                SettableBeanProperty prop = propertyIterator.next();
                Class<?> declaringClass = prop.getMember().getDeclaringClass();
                String canonicalClassName = declaringClass.getCanonicalName();
                if ((canonicalClassName != null) && globalDefaults.hasPath(canonicalClassName)) {
View Full Code Here

        if (!aliasDefaults.isEmpty()) {
            if (deserializer instanceof DelegatingDeserializer) {
                deserializer = ((DelegatingDeserializer) deserializer).getDelegatee();
            }
            if ((deserializer instanceof BeanDeserializerBase) && (aliasDefaults.get("_primary") != null)) {
                BeanDeserializerBase beanDeserializer = (BeanDeserializerBase) deserializer;
                String primaryField = (String) aliasDefaults.get("_primary").unwrapped();
                if (!fieldValues.has(primaryField)) {
                    // user has not explicitly set a value where _primary points, see if _primary is a plugin type
                    SettableBeanProperty primaryProperty = beanDeserializer.findProperty(primaryField);
                    if ((primaryProperty != null) && primaryProperty.hasValueTypeDeserializer()) {
                        TypeDeserializer primaryTypeDeserializer = primaryProperty.getValueTypeDeserializer();
                        if (primaryTypeDeserializer instanceof CodecTypeDeserializer) {
                            CodecTypeIdResolver primaryPropertyTypeIdResolver =
                                    ((CodecTypeDeserializer) primaryTypeDeserializer).idRes;
                            String possibleInlinedPrimary = null;
                            Iterator<String> fieldNames = fieldValues.fieldNames();
                            while (fieldNames.hasNext()) {
                                String fieldName = fieldNames.next();
                                if ((fieldName.charAt(0) != '_') && !beanDeserializer.hasProperty(fieldName)) {
                                    if (primaryPropertyTypeIdResolver.isValidTypeId(fieldName)) {
                                        if (possibleInlinedPrimary == null) {
                                            possibleInlinedPrimary = fieldName;
                                        } else {
                                            String message = String.format(
                                                    "%s and %s are both otherwise unknown properties that "
                                                    + "could be types for the _primary property %s whose category is "
                                                    + "%s. This is too ambiguous to resolve.",
                                                    possibleInlinedPrimary, fieldName, primaryField,
                                                    ((CodecTypeDeserializer) primaryTypeDeserializer)
                                                            .pluginMap.category());
                                            JsonMappingException ex =
                                                    ctxt.instantiationException(_baseType.getRawClass(), message);
                                            ex.prependPath(beanDeserializer.getValueType(), fieldName);
                                            throw ex;
                                        }
                                    }
                                }
                            }
View Full Code Here

        if (deserializer instanceof DelegatingDeserializer) {
            JsonDeserializer<?> delegatee = ((DelegatingDeserializer) deserializer).getDelegatee();
            JsonDeserializer<?> replacementDelegatee = modifyDeserializer(config, beanDesc, delegatee);
            return deserializer.replaceDelegatee(replacementDelegatee);
        } else if (deserializer instanceof BeanDeserializerBase) {
            BeanDeserializerBase beanDeserializer = (BeanDeserializerBasedeserializer;
            ObjectNode fieldDefaults = config.getNodeFactory().objectNode();
            Iterator<SettableBeanProperty> propertyIterator = beanDeserializer.properties();
            while (propertyIterator.hasNext()) {
                SettableBeanProperty prop = propertyIterator.next();
                Class<?> declaringClass = prop.getMember().getDeclaringClass();
                String canonicalClassName = declaringClass.getCanonicalName();
                if ((canonicalClassName != null) && globalDefaults.hasPath(canonicalClassName)) {
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.databind.deser.BeanDeserializerBase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.