|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectxv.text.template.TemplateEnvironment
public class TemplateEnvironment
An environment within a template. Basically this is a map of strings to Java objects. (In fact, the implementation is wrapped around a map.)
However, due to the myriad of ways that the collections Map interface allows values to be snuck in, this class does not actually implement Map at present.
Constructor Summary | |
---|---|
TemplateEnvironment()
|
|
TemplateEnvironment(Map<? extends String,? extends Object> original)
Create a new environment using values from the given map. |
|
TemplateEnvironment(String first,
String... remaining)
This is a convenience constructor. |
Method Summary | |
---|---|
boolean |
contains(String var)
Check if the environment has a binding for the given variable name. |
Object |
get(String var)
|
Object |
get(String var,
Object def)
|
String |
getString(String var)
Gets the given variable as a string. |
String[] |
getVariableNames()
|
Object |
remove(String var)
Removes the given binding. |
void |
set(String var,
Object value)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TemplateEnvironment()
public TemplateEnvironment(Map<? extends String,? extends Object> original)
I'm aware that String is final, but, ...whatever.
original
- public TemplateEnvironment(String first, String... remaining)
first
- the first string - this is a hack to prevent "ambiguous"
errorsremaining
- the remaining argumentsMethod Detail |
---|
public Object get(String var)
public Object get(String var, Object def)
public String getString(String var)
null
, the string
"null"
is returned. Otherwise this converts to a string
directly via Object.toString()
.
var
-
public boolean contains(String var)
var
- the variable name to check
public void set(String var, Object value)
public Object remove(String var)
var
-
public String[] getVariableNames()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |