T - Type of object which can be loaded by the Loaderpublic abstract class JsonLoader<T> extends AsciiFileLoader<T>
JsonLoader can be used
to load and process json files more easily.| Modifier and Type | Field and Description |
|---|---|
protected org.json.JSONObject |
jsonObject
The JSONObject.
|
| Constructor and Description |
|---|
JsonLoader() |
| Modifier and Type | Method and Description |
|---|---|
protected Color |
getColor(org.json.JSONObject json)
Reads a
Color from a JSON
declaration. |
org.json.JSONObject |
getJsonObject()
Returns the parsed JSONOBject
|
protected Texture |
getTexture(org.json.JSONObject json)
Reads a
Texture from a JSON
declaration. |
void |
load(String name,
String input)
Constructs the
JSONObject and parses it. |
void |
setJsonObject(org.json.JSONObject jsonObject)
Sets the JSONObject
|
static Object[] |
toObjectArray(org.json.JSONArray array)
Converts a
JSONArray into an array of
Objects |
getObject, getPreProcessorpublic void load(String name, String input) throws LoadingException
JSONObject and parses it.
This performs any type of loading and parsing.
This should load the resource, but should not constructed it,
just loading/parsing and preparations to create the objectname - The name of the original fileinput - The input fileLoadingException - when the loading failspublic org.json.JSONObject getJsonObject()
public void setJsonObject(org.json.JSONObject jsonObject)
jsonObject - The new JSONObjectpublic static Object[] toObjectArray(org.json.JSONArray array)
JSONArray into an array of
Objectsarray - JSONArrayprotected Color getColor(org.json.JSONObject json)
Color from a JSON
declaration.
Components not specified will default to 1.json - JSONObjectprotected Texture getTexture(org.json.JSONObject json) throws Exception
Texture from a JSON
declaration.
Loads it via the ResourceLoaderjson - JSONObjectException - (from ResourceLoader)Copyright © 2014. All rights reserved.