- All Implemented Interfaces:
javax0.jamal.api.Identified
,javax0.jamal.api.Macro
,javax0.jamal.api.ServiceLoaded
{@env JAVA_HOME}
will result the current value of the environment variable JAVA_HOME
.
If there is a ?
after the name then the macro returns "true
" (string without the quotes) if the
environment variable is defined and "false
" if it is not defined. Testing just the value of the environment
variable in an if
macro may be misleading in case the value of the environment variable is true
or
false
or empty string.
If there is a !
after the name then the macro will throw an exception in case the environment variable is
not defined.
The input of the macro is trimmed at the start, so starting and ending spaces do not count. If the last character
after the trimming is ?
or !
it is chopped off and the string is chopped again. It means that you
can have spaces between the name and the ?
or !
character.
You cannot have both ?
and !
characters. If your environment variable name ends with the ?
or !
character then you cannot use this macro, and you are in trouble. However, in that case you are a sick
bastard, and you are in trouble anyway.
-
Nested Class Summary
Nested classes/interfaces inherited from interface javax0.jamal.api.Identified
javax0.jamal.api.Identified.Undefined
Nested classes/interfaces inherited from interface javax0.jamal.api.Macro
javax0.jamal.api.Macro.Stateful
-
Field Summary
Fields inherited from interface javax0.jamal.api.Identified
DEFAULT_MACRO, MACRO_NAME_ARG1, MACRO_NAME_ARG2
Fields inherited from interface javax0.jamal.api.Macro
FETCH
-
Constructor Summary
-
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javax0.jamal.api.Macro
fetch, getId, getIds, prefetch
-
Constructor Details
-
Env
public Env()
-
-
Method Details
-
evaluate
public String evaluate(javax0.jamal.api.Input in, javax0.jamal.api.Processor processor) throws javax0.jamal.api.BadSyntax - Specified by:
evaluate
in interfacejavax0.jamal.api.Macro
- Throws:
javax0.jamal.api.BadSyntax
-