Android Open Source - json2view Dynamic Property Json Builder

From Project

Back to project page json2view.


The source code is released under:

MIT License

If you think the Android project json2view listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.avocarrot.json2view;
/*from   ww  w  .  j  av  a  2s . c  o m*/
import android.util.Log;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class DynamicPropertyJsonBuilder {

    private String name;
    private String type;
    private String value;

    public DynamicPropertyJsonBuilder() {}

    public DynamicPropertyJsonBuilder setName(DynamicProperty.NAME name) { = name.toString();
        return this;
    public DynamicPropertyJsonBuilder setType(DynamicProperty.TYPE type) {
        this.type = type.toString();
        return this;
    public DynamicPropertyJsonBuilder setValue(Object value) {
        this.value = value.toString();
        return this;

    public JSONObject build() {
        Map<String, Object> map = new HashMap<>();
        map.put("name", name);
        map.put("type", type);
        map.put("value", value);
        return new JSONObject(map);


Java Source Code List