Examples of BeanPropertyWriter


Examples of com.fasterxml.jackson.databind.ser.BeanPropertyWriter

                // also: if this is property to write as text ("unwrap"), need to:
                if (i == textIndex) {
                    xgen.setNextIsUnwrapped(true);
                }
                xgen.setNextName(xmlNames[i]);
                BeanPropertyWriter prop = props[i];
                if (prop != null) { // can have nulls in filtered list
                    filter.serializeAsField(bean, xgen, provider, prop);
                }
            }
            if (_anyGetterWriter != null) {
View Full Code Here

Examples of com.fasterxml.jackson.databind.ser.BeanPropertyWriter

            BeanPropertyWriter[] filteredProperties)
    {
        int attrCount = 0;

        for (int i = 0, len = properties.length; i < len; ++i) {
            BeanPropertyWriter bpw = properties[i];
           
            if (!_isAttribute(bpw)) {
                continue;
            }
            // Swap if attribute and there are preceding elements:
            if (attrCount < i) {
                properties[i] = properties[attrCount];
                properties[attrCount] = bpw;
                if (filteredProperties != null) {
                    BeanPropertyWriter fbpw = filteredProperties[i];
                    filteredProperties[i] = filteredProperties[attrCount];
                    filteredProperties[attrCount] = fbpw;
                }
            }
            ++attrCount;
View Full Code Here

Examples of com.fasterxml.jackson.databind.ser.BeanPropertyWriter

        public List<BeanPropertyWriter> changeProperties(SerializationConfig config, BeanDescription beanDesc,
                List<BeanPropertyWriter> beanProperties)
        {
            Iterator<BeanPropertyWriter> it = beanProperties.iterator();
            while (it.hasNext()) {
                BeanPropertyWriter bpw = it.next();
                if (bpw.getName().equals(_removedProperty)) {
                    it.remove();
                }
            }
            return beanProperties;
        }
View Full Code Here

Examples of com.fasterxml.jackson.databind.ser.BeanPropertyWriter

            JavaType strType = config.constructType(String.class);
            // we need a valid BeanPropertyDefinition; this will do (just need name to match)
            POJOPropertyBuilder prop = new POJOPropertyBuilder(new PropertyName("bogus"), null, true);
            try {
                AnnotatedField f = new AnnotatedField(EmptyBean.class.getDeclaredField("name"), null);
                beanProperties.add(new BeanPropertyWriter(prop, f, null,
                        strType,
                        null, null, strType,
                        false, null));
            } catch (NoSuchFieldException e) {
                throw new IllegalStateException(e.getMessage());
View Full Code Here

Examples of com.fasterxml.jackson.databind.ser.BeanPropertyWriter

        // And then collect namespace information
        _xmlNames = new QName[_props.length];
        int textIndex = -1;
        for (int i = 0, len = _props.length; i < len; ++i) {
            BeanPropertyWriter bpw = _props[i];
            XmlInfo info = (XmlInfo) bpw.getInternalSetting(KEY_XML_INFO);
            String ns = null;
            if (info != null) {
                ns = info.getNamespace();
                if (textIndex < 0 && info.isText()) {
                    textIndex = i;
                }
            }
            _xmlNames[i] = new QName((ns == null) ? "" : ns, bpw.getName());
        }
        _textPropertyIndex = textIndex;
    }
View Full Code Here

Examples of com.fasterxml.jackson.databind.ser.BeanPropertyWriter

                // also: if this is property to write as text ("unwrap"), need to:
                if (i == textIndex) {
                    xgen.setNextIsUnwrapped(true);
                }
                xgen.setNextName(xmlNames[i]);
                BeanPropertyWriter prop = props[i];
                if (prop != null) { // can have nulls in filtered list
                    prop.serializeAsField(bean, xgen, provider);
                }
                // Reset to avoid next value being written as unwrapped,
                // for example when property is suppressed
                if (i == textIndex) {
                    xgen.setNextIsUnwrapped(false);
View Full Code Here

Examples of com.fasterxml.jackson.databind.ser.BeanPropertyWriter

                // also: if this is property to write as text ("unwrap"), need to:
                if (i == textIndex) {
                    xgen.setNextIsUnwrapped(true);
                }
                xgen.setNextName(xmlNames[i]);
                BeanPropertyWriter prop = props[i];
                if (prop != null) { // can have nulls in filtered list
                    filter.serializeAsField(bean, xgen, provider, prop);
                }
            }
            if (_anyGetterWriter != null) {
View Full Code Here

Examples of com.fasterxml.jackson.databind.ser.BeanPropertyWriter

            BeanPropertyWriter[] filteredProperties)
    {
        int attrCount = 0;

        for (int i = 0, len = properties.length; i < len; ++i) {
            BeanPropertyWriter bpw = properties[i];

            if (!_isAttribute(bpw)) {
                continue;
            }

            // Move attribute a few places done as necessary
            int moveBy = i-attrCount;
            if (moveBy > 0) {
                System.arraycopy(properties, attrCount, properties, attrCount+1, moveBy);
                properties[attrCount] = bpw;
                if (filteredProperties != null) {
                    BeanPropertyWriter fbpw = filteredProperties[i];
                    System.arraycopy(filteredProperties, attrCount, filteredProperties, attrCount+1, moveBy);
                    filteredProperties[attrCount] = fbpw;
                }
            }
            ++attrCount;
View Full Code Here

Examples of com.fasterxml.jackson.databind.ser.BeanPropertyWriter

                    } else {
                        // Give up, don't attempt to serialise it
                        return null;
                    }
                } else if (fieldSerializer instanceof BeanSerializerBase) {
                    BeanPropertyWriter writer = JacksonAccessor
                            .findPropertyWriter(
                                    (BeanSerializerBase) serializer, field);
                    if (writer != null) {
                        fieldSerializer = writer.getSerializer();
                        if (fieldSerializer == null) {
                            // Do a generic lookup
                            fieldSerializer = JacksonAccessor
                                    .findValueSerializer(serializerProvider,
                                            writer.getType());
                        }
                    } else {
                        // Give up
                        return null;
                    }
View Full Code Here

Examples of com.fasterxml.jackson.databind.ser.BeanPropertyWriter

                    } else {
                        // Give up, don't attempt to serialise it
                        return null;
                    }
                } else if (fieldSerializer instanceof BeanSerializerBase) {
                    BeanPropertyWriter writer = JacksonAccessor
                            .findPropertyWriter(
                                    (BeanSerializerBase) serializer, field);
                    if (writer != null) {
                        fieldSerializer = writer.getSerializer();
                        if (fieldSerializer == null) {
                            // Do a generic lookup
                            fieldSerializer = JacksonAccessor
                                    .findValueSerializer(serializerProvider,
                                            writer.getType());
                        }
                    } else {
                        // Give up
                        return null;
                    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.