public final class TurretLang
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static char |
SEPARATOR
Constant for holding the char used to separate the variable name and its value in the declaration.
|
static float |
VERSION
Version of Turret Language
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
createDeclaration(java.lang.String name,
java.lang.String value)
Creates a String declaration for for the given variable name and the value.
|
static TLVariable |
declare(java.lang.String name,
java.lang.String value)
Creates a
TLVariable representation for for the given variable name and the value. |
static java.lang.String |
getVariableName(java.lang.String declaration)
Gets the variable name provided in the declaration.
|
static java.lang.String |
getVariableValue(java.lang.String declaration)
Gets the variable value provided in the declaration.
|
static boolean |
isDeclaration(java.lang.String string)
Checks if the given string is a valid variable declaration.
|
static boolean |
isNumeric(java.lang.String s) |
static TLConfiguration |
load(java.io.File source)
Loads a file into a
TLConfiguration . |
public static final char SEPARATOR
public static final float VERSION
public static final java.lang.String getVariableValue(java.lang.String declaration) throws TLException
E.g. declaration "java:minecraft" will return "minecraft".
declaration
- The declaration, e.g. "java:minecraft"TLException
- If the declaration is invalid.java.lang.IllegalArgumentException
- If the declaration is null.public static final java.lang.String getVariableName(java.lang.String declaration) throws TLException
E.g. declaration "turret:danger" will return "turret".
declaration
- The declaration, e.g. "turret:danger"TLException
- If the declaration is invalid.java.lang.IllegalArgumentException
- If the declaration is null.public static final java.lang.String createDeclaration(java.lang.String name, java.lang.String value)
E.g. createDeclaration("exception", "stupid") returns "exception:stupid";
name
- The name of the variable.value
- The value of the variable.java.lang.IllegalArgumentException
- If some argument is null.declare(String, String)
public static final TLVariable declare(java.lang.String name, java.lang.String value)
TLVariable
representation for for the given variable name and the value. E.g. declare("life", "42") returns "life:42";
name
- The name of the variable.value
- The value of the variable.TLVariable
object.java.lang.IllegalArgumentException
- If some argument is null.createDeclaration(String, String)
public static final TLConfiguration load(java.io.File source) throws java.io.IOException, TLException
TLConfiguration
.source
- The file to load from.java.io.IOException
- If an IO exception occurs.TLException
- If the file is not available or is not a Turret Language file.public static final boolean isDeclaration(java.lang.String string)
string
- The string to check.public static final boolean isNumeric(java.lang.String s)