Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.jackson.databind.ser.impl;
 
 
 
public class IteratorSerializer
    extends AsArraySerializerBase<Iterator<?>>
    public IteratorSerializer(JavaType elemTypeboolean staticTypingTypeSerializer vts,
            BeanProperty property)
    {
        super(Iterator.classelemTypestaticTypingvtspropertynull);
    }
            BeanProperty propertyTypeSerializer vtsJsonSerializer<?> valueSerializer)
    {
        super(srcpropertyvtsvalueSerializer);
    }
    @Override
    public boolean isEmpty(Iterator<?> value) {
        return (value == null) || !value.hasNext();
    }
    @Override
    public boolean hasSingleElement(Iterator<?> value) {
        // no really good way to determine (without consuming iterator), so:
        return false;
    }
    
    @Override
        return new IteratorSerializer(vts);
    }
    @Override
    public IteratorSerializer withResolved(BeanProperty property,
            TypeSerializer vtsJsonSerializer<?> elementSerializer) {
        return new IteratorSerializer(thispropertyvtselementSerializer);
    }
    @Override
    public void serializeContents(Iterator<?> valueJsonGenerator jgenSerializerProvider provider)
        throws IOExceptionJsonGenerationException
    {
        if (value.hasNext()) {
            final TypeSerializer typeSer = ;
            JsonSerializer<ObjectprevSerializer = null;
            Class<?> prevClass = null;
            do {
                Object elem = value.next();
                if (elem == null) {
                    provider.defaultSerializeNull(jgen);
                } else {
                    // Minor optimization to avoid most lookups:
                    Class<?> cc = elem.getClass();
                    JsonSerializer<ObjectcurrSerializer;
                    if (cc == prevClass) {
                        currSerializer = prevSerializer;
                    } else {
                        currSerializer = provider.findValueSerializer(cc);
                        prevSerializer = currSerializer;
                        prevClass = cc;
                    }
                    if (typeSer == null) {
                        currSerializer.serialize(elemjgenprovider);
                    } else {
                        currSerializer.serializeWithType(elemjgenprovidertypeSer);
                    }
                }
            } while (value.hasNext());
        }
    }
New to GrepCode? Check out our FAQ X