|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--sunlabs.brazil.util.Format
Format a string by substituting values into it from a properties object.
| Constructor Summary | |
Format()
|
|
| Method Summary | |
static String |
getProperty(Properties props,
String expr,
String defaultValue)
Allow a property name to contain the value of another property, permitting nested variable substitution in attribute values. |
static boolean |
isFalse(String s)
See if a String represents a "false" boolean value, which consists of: "no", "false", "off", or "0", in any case. |
static boolean |
isTrue(String s)
See if a String represents a "true" boolean value, which consists of: "yes", "true", "on", or "1", in any case. |
static String |
subst(Dictionary props,
String str)
Allow a tag attribute value to contain the value of another property, permitting nested variable substitution in attribute values. |
static String |
subst(Dictionary props,
String str,
boolean noEsc)
Allow a tag attribute value to contain the value of another property, permitting nested variable substitution in attribute values. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Format()
| Method Detail |
public static String getProperty(Properties props,
String expr,
String defaultValue)
subst(java.util.Dictionary, java.lang.String).
"ghi" => "foo"
"deffoojkl" => "baz"
"abcbazmno" => "garply"
getProperty("ghi") => "foo"
getProperty("def${ghi}jkl") => "baz"
getProperty("abc${def${ghi}jkl}mno") => "garply"
props - The table of variables to use when substituting.expr - The property name, prossibly containing substitutions.defaultValue - The value to use if the top-level substitution does not
exist. May be null.
public static String subst(Dictionary props,
String str)
The sequence "\X" is identical to "X", except when "X" is one of:
"ghi" = "foo"
"deffoojkl" = "baz"
"abcbazmno" = "garply"
subst("ghi") = "ghi"
subst("def${ghi}jkl") = "deffoojkl"
subst("def\${ghi}jkl") = "def${ghi}jkl"
subst("abc${def${ghi}jkl}mno") = "abcbazmno"
subst("${abc${def${ghi}jkl}mno}") = "garply"
props - The table of variables to substitute.
If this is a Properties object, then the
getProperty() method is used instead of the
Dictionary class get() method.str - The expression containing the substitutions.
Embedded property names, bracketted by "${" and "}"
are looked up in the props table and replaced with
their value. Nested substitutions are allowed.
public static String subst(Dictionary props,
String str,
boolean noEsc)
above.
if noEsc is true, then
The sequence "\X" is identical to "\X" for all X except X=$.
public static boolean isTrue(String s)
public static boolean isFalse(String s)
|
Version 2.1, Generated 12/30/04 Copyright (c) 2001-2004, Sun Microsystems. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||