Class JsonBuilder
java.lang.Object
net.lcc.sollib.api.common.config.builder.JsonBuilder
- All Implemented Interfaces:
IJsonBuilder
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface net.lcc.sollib.api.common.config.builder.IJsonBuilder
IJsonBuilder.IArrayBuilder -
Constructor Summary
ConstructorsConstructorDescriptionJsonBuilder(SolConfig config) Instantiates a JsonBuilder configured for the creation of a SolConfig
Allows directly binding a ConfigEntry to the config -
Method Summary
Modifier and TypeMethodDescriptionaddArray(String key, Consumer<IJsonBuilder.IArrayBuilder> consumer) addObject(String key, IConfigurable consumer) protected void<T> IJsonBuilderbind(ConfigEntry<T> entry) comment()bind(ConfigEntry)should instead be used to directly bind a ConfigEntry to this pathprotected voidjump(boolean comma) com.google.gson.JsonObjecttoJson()static com.google.gson.JsonElementtoString()
-
Constructor Details
-
JsonBuilder
Instantiates a JsonBuilder configured for the creation of a SolConfig
Allows directly binding a ConfigEntry to the config -
JsonBuilder
public JsonBuilder()
-
-
Method Details
-
toJson
public static com.google.gson.JsonElement toJson(String json) throws com.google.gson.stream.MalformedJsonException - Returns:
- The JSON represented by the given String
- Throws:
com.google.gson.stream.MalformedJsonException- If the given String has wrong syntax
-
toString
- Specified by:
toStringin interfaceIJsonBuilder- Overrides:
toStringin classObject- Returns:
- A String representation of the JSON this built, with pretty printing
-
toJson
public com.google.gson.JsonObject toJson()- Specified by:
toJsonin interfaceIJsonBuilder- Returns:
- The JSON this built
-
getCurrentPath
bind(ConfigEntry)should instead be used to directly bind a ConfigEntry to this path- Specified by:
getCurrentPathin interfaceIJsonBuilder- Returns:
- The current config path this builder is at
-
jump
protected void jump(boolean comma) -
comment
- Specified by:
commentin interfaceIJsonBuilder
-
comment
- Specified by:
commentin interfaceIJsonBuilder
-
bind
- Specified by:
bindin interfaceIJsonBuilder
-
append
-
add
- Specified by:
addin interfaceIJsonBuilder
-
add
- Specified by:
addin interfaceIJsonBuilder
-
add
- Specified by:
addin interfaceIJsonBuilder
-
add
- Specified by:
addin interfaceIJsonBuilder
-
addObject
- Specified by:
addObjectin interfaceIJsonBuilder
-
addObject
- Specified by:
addObjectin interfaceIJsonBuilder
-
addArray
- Specified by:
addArrayin interfaceIJsonBuilder
-
addArray
- Specified by:
addArrayin interfaceIJsonBuilder
-