Examples of BeanPropertyWriter


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

        }

        JsonSerializer serializer = JacksonAccessor.findValueSerializer(
                JacksonAccessor.getSerializerProvider(objectMapper), type);
        if (serializer instanceof BeanSerializerBase) {
            BeanPropertyWriter writer = JacksonAccessor.findPropertyWriter(
                    (BeanSerializerBase) serializer, "_id");
            if (writer != null) {
                idSerializer = writer.getSerializer();
            }
        }

        if (idDeserializer != null && idSerializer != null) {
            return new IdHandler.JacksonIdHandler(idSerializer, idDeserializer,
View Full Code Here

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

    public void testSingleIntAccessorGeneration() throws Exception
    {
        Method method = Bean1.class.getDeclaredMethod("getX");
        AnnotatedMethod annMethod = new AnnotatedMethod(method, null, null);
        PropertyAccessorCollector coll = new PropertyAccessorCollector(Bean1.class);
        BeanPropertyWriter bpw = new BeanPropertyWriter(SimpleBeanPropertyDefinition.construct(null, annMethod, "x"),
                annMethod, null,
                null,
                null, null, null,
                false, null);
        coll.addIntGetter(bpw);
View Full Code Here

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

       
        for (String methodName : methodNames) {
            Method method = Bean3.class.getDeclaredMethod(methodName);
            AnnotatedMethod annMethod = new AnnotatedMethod(method, null, null);
            // should we translate from method name to property name?
            coll.addIntGetter(new BeanPropertyWriter(SimpleBeanPropertyDefinition.construct(null, annMethod, methodName),
                    annMethod, null,
                    null,
                    null, null, null,
                    false, null));
        }
View Full Code Here

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

                "getX", "getY", "get3", "get4", "get5", "get6", "get7"
        };
        for (String methodName : methodNames) {
            Method method = BeanN.class.getDeclaredMethod(methodName);
            AnnotatedMethod annMethod = new AnnotatedMethod(method, null, null);
            coll.addIntGetter(new BeanPropertyWriter(SimpleBeanPropertyDefinition.construct(null, annMethod, methodName),
                    annMethod, null,
                    null,
                    null, null, null,
                    false, null));
        }
View Full Code Here

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

        // Ok, first: collect namespace information
        _xmlNames = new QName[_props.length];
        // First, find namespace information
        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();
            }
            _xmlNames[i] = new QName((ns == null) ? "" : ns, bpw.getName());
        }     
       
        /* Then make sure attributes are sorted before elements, keep track
         * of how many there are altogether
         */
 
View Full Code Here

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

            for (final int len = props.length; i < len; ++i) {
                if (i == attrCount) {
                    jgen.setNextIsAttribute(false);
                }
                jgen.setNextName(xmlNames[i]);
                BeanPropertyWriter prop = props[i];
                if (prop != null) { // can have nulls in filtered list
                    prop.serializeAsField(bean, jgen, provider);
                }
            }
            if (_anyGetterWriter != null) {
                _anyGetterWriter.getAndSerialize(bean, jgen, provider);
            }
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

        // 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
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.