All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fasterxml.jackson.jr.ob.comp.ArrayComposer Maven / Gradle / Ivy

Go to download

Simple data-binding that builds directly on jackson-core (streaming), has no other dependencies, and provides additional builder-style content generator

There is a newer version: 2.18.2
Show newest version
package com.fasterxml.jackson.jr.ob.comp;

import java.io.IOException;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;

public class ArrayComposer
    extends SequenceComposer>
{
    protected final PARENT _parent;

    public ArrayComposer(PARENT parent, JsonGenerator g) {
        super(g);
        _parent = parent;
    }

    /*
    /**********************************************************************
    /* Abstract method impls
    /**********************************************************************
     */

    @Override
    protected ArrayComposer _start() throws IOException, JsonProcessingException {
        _generator.writeStartArray();
        return this;
    }

    @Override
    protected Object _finish() throws IOException, JsonProcessingException {
        if (_open) {
            _open = false;
            _generator.writeEndArray();
        }
        return null;
    }

    /*
    /**********************************************************************
    /* Compose methods, structures
    /**********************************************************************
     */
    
    public PARENT end()
        throws IOException, JsonProcessingException
    {
        _closeChild();
        if (_open) {
            _open = false;
            _generator.writeEndArray();
            _parent._childClosed();
        }
        return _parent;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy