Data Clusters

Where data is stored and manipulated for many applications.

Data Clusters are simply a mapping of keys and values with the ability to store comments and manipulate them in many ways. Here is the basic usage of data clusters.

//Create a new DataCluster
DataCluster cc = new DataCluster();

//Set some data
cc.set("some.key.1", false);
cc.set("some.key.2", "a string");
cc.set("some.key.3", 123123123);
cc.set("some.key.4", 3453453454323423423l);
cc.set("some.key.5", 3.5454545454545454545);
cc.set("some.key.6", new GList<String>(new String[]{"String", "List"}));

//Crop the DataCluster
DataCluster cropped = cc.crop("some.key");
cropped.getBoolean("1");
cropped.getString("2");
cropped.getInt("3");
cropped.getLong("4");
cropped.getDouble("5");
cropped.getStringList("6");

//Output
JSONObject s = cc.toJSON();
FileConfiguration fc = cc.toYaml();

//Add
cc.addJson(new JSONObject("{'some.key.7': 'foobar'}"));

By themselves, they are very useful, however they can do so much more with the help of configurable objects.

results matching ""

    No results matching ""