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

com.github.developframework.kite.fastjson.FastjsonArrayNodeProxy Maven / Gradle / Ivy

There is a newer version: 1.0.1
Show newest version
package com.github.developframework.kite.fastjson;

import com.alibaba.fastjson.JSONArray;
import com.github.developframework.kite.core.AssembleContext;
import com.github.developframework.kite.core.node.ArrayNodeProxy;
import com.github.developframework.kite.core.node.ObjectNodeProxy;
import com.github.developframework.kite.core.structs.ArrayAttributes;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * @author qiushui on 2021-07-15.
 */
@RequiredArgsConstructor
public final class FastjsonArrayNodeProxy implements ArrayNodeProxy {

    @Getter
    private final JSONArray node;

    @Override
    public void addValue(ArrayAttributes arrayAttributes, Object value) {
        node.add(value);
    }

    @Override
    public ObjectNodeProxy addObject(ArrayAttributes arrayAttributes, AssembleContext context) {
        ObjectNodeProxy objectNodeProxy = context.createObjectNodeProxy();
        node.add(objectNodeProxy.getNode());
        return objectNodeProxy;
    }

    @Override
    public ArrayNodeProxy addArray(ArrayAttributes arrayAttributes, AssembleContext context) {
        ArrayNodeProxy arrayNodeProxy = context.createArrayNodeProxy();
        node.add(arrayNodeProxy.getNode());
        return arrayNodeProxy;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy