public final class Runtime extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static GoloClassLoader |
classLoader()
Returns the current thread class loader.
|
static CliCommand |
command()
Returns the golo command currently used.
|
static void |
command(CliCommand cmd)
Defines the golo command currently used.
|
static boolean |
debugMode()
Checks if debug mode is active.
|
static void |
debugMode(boolean v)
Defines debug mode.
|
static java.lang.Class<?> |
load(java.lang.Object module)
Load a golo file given its path or URL.
|
static java.lang.Class<?> |
load(java.lang.Object module,
boolean failOnException)
Load a golo file given its path or URL.
|
static boolean |
loadBoolean(java.lang.String prop,
java.lang.String env,
boolean defaultValue)
Get a boolean value from a system property or an environment variable.
|
static boolean |
loadBoolean(java.lang.String value,
java.lang.String prop,
java.lang.String env,
boolean defaultValue)
Get a boolean value from a system property or an environment variable.
|
static boolean |
showStackTrace()
Checks if the main golo command should print stack traces on error.
|
static void |
showStackTrace(boolean v)
Defines if the main golo command should print stack traces on error.
|
static java.lang.String |
version()
Returns the current golo version.
|
public static boolean loadBoolean(java.lang.String prop, java.lang.String env, boolean defaultValue)
Equivalent to loadBoolean("true", prop, env, defaultValue)
prop
- system property to get the value from, ignored if null
.env
- environment variable to get the value from, ignored if null
.defaultValue
- value to return if neither the property nor the environment are defined.public static boolean loadBoolean(java.lang.String value, java.lang.String prop, java.lang.String env, boolean defaultValue)
Checks if the property is defined and equals to the value (case insensitive), otherwise checks the environment variable, then use the default value.
value
- content of the property.prop
- system property to get the value from, ignored if null
.env
- environment variable to get the value from, ignored if null
.defaultValue
- value to return if neither the property nor the environment are defined.java.lang.NullPointerException
- if value
is null and one of the property or environment is defined.public static boolean debugMode()
The initial value is false, but can be redefined using the golo.debug
system property, or the
GOLO_DEBUG
environment variable.
public static void debugMode(boolean v)
public static boolean showStackTrace()
public static void showStackTrace(boolean v)
public static void command(CliCommand cmd)
This command is called at init time and should not be called in userland code.
public static CliCommand command()
public static GoloClassLoader classLoader()
Possibly wrapped in a GoloClassLoader
if necessary.
public static java.lang.Class<?> load(java.lang.Object module) throws java.lang.Exception
Equivalent to load(module, true)
.
module
- can be a String
, a java.nio.file.Path
, a java.net.URL
or a java.net.URI
identifying the file to load, or directly a GoloModule
.java.lang.Exception
load(Object, boolean)
public static java.lang.Class<?> load(java.lang.Object module, boolean failOnException) throws java.lang.Exception
If failOnException
is false, any exception is swallowed and null is return.
module
- can be a String
, a java.nio.file.Path
, a java.net.URL
or a java.net.URI
identifying the file to load, or directly a GoloModule
.failOnException
- re-raise exception or notnull
if an error occurred and failOnException
is false
java.lang.Exception
load(Object, boolean)
public static java.lang.String version()