Package io.github.cs1302uga
Class GsonTool
java.lang.Object
org.apache.velocity.tools.generic.SafeConfig
io.github.cs1302uga.GsonTool
@DefaultKey("gson")
public class GsonTool
extends org.apache.velocity.tools.generic.SafeConfig
An Apache Velocity tool that provides utility methods to manipulate JSON code using
the gson JSON library.
- Author:
- Michael E. Cotterell
-
Field Summary
Fields inherited from class org.apache.velocity.tools.generic.SafeConfig
LOCK_CONFIG_KEY, log, LOGGER_NAME_KEY, SAFE_MODE_KEY, USE_CLASS_LOGGER_KEY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncom.google.gson.JsonElement
Parse the supplied JSONcontent
string using gson.com.google.gson.JsonElement
parseResource
(String resource) Parse the supplied JSONresouce
using gson.Methods inherited from class org.apache.velocity.tools.generic.SafeConfig
configure, configure, getLog, initLogger, isConfigLocked, isSafeMode, setLockConfig, setSafeMode
-
Constructor Details
-
GsonTool
public GsonTool()Construct aGsonTool
object.
-
-
Method Details
-
parse
Parse the supplied JSONcontent
string using gson.- Parameters:
content
- JSON content string- Returns:
- An
JsonElement
that wraps the suppliedcontent
.
-
parseResource
Parse the supplied JSONresouce
using gson.- Parameters:
resource
- the resource name- Returns:
- An
JsonElement
that wraps the JSON inresource
.
-