|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.jett.util.AttributeUtil
public class AttributeUtil
The AttributeUtil utility class provides utility methods for
evaluating Expressions that are expected to result in a
specific type.
| Field Summary | |
|---|---|
static java.lang.String |
SPEC_SEP
Separates expressions in attributes that take multiple values. |
static java.lang.String |
SPEC_SEP_2
Separates expressions in attributes that take multiple values at a second level. |
| Constructor Summary | |
|---|---|
AttributeUtil()
|
|
| Method Summary | ||
|---|---|---|
static void |
ensureAtLeastOneExists(java.util.List<org.apache.poi.ss.usermodel.RichTextString> attrValues,
java.util.List<java.lang.String> attrNames)
Ensures that at least one of the given attribute values exists. |
|
static void |
ensureAtMostOneExists(java.util.List<org.apache.poi.ss.usermodel.RichTextString> attrValues,
java.util.List<java.lang.String> attrNames)
Ensures that at most one of the given attribute values exists. |
|
static void |
ensureExactlyOneExists(java.util.List<org.apache.poi.ss.usermodel.RichTextString> attrValues,
java.util.List<java.lang.String> attrNames)
Ensures that exactly one of the given attribute values exists. |
|
static boolean |
evaluateBoolean(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
boolean def)
Evaluates the given text, which may have embedded Expressions, and attempts to extract a boolean value from
the result, calling Boolean.parseBoolean() on the result if
necessary. |
|
static double |
evaluateDouble(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.lang.String attrName,
double def)
Evaluates the given text, which may have embedded Expressions, and attempts to extract a double value from
the result, calling toString() on the result and parsing it
if necessary. |
|
static int |
evaluateInt(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.lang.String attrName,
int def)
Evaluates the given text, which may have embedded Expressions, and attempts to extract an integer value from
the result, calling toString() on the result and parsing it
if necessary. |
|
static java.util.List<java.lang.Integer> |
evaluateIntegerArray(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.util.List<java.lang.Integer> def)
Evaluates the given text, which may have embedded Expressions, and attempts to extract a List of
Integers from the result, accepting an int
array or a Collection or delimited list of numbers. |
|
static java.util.List<java.util.List<java.lang.Integer>> |
evaluateIntegerArrayArray(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.util.List<java.util.List<java.lang.Integer>> def)
Evaluates the given text, which may have embedded Expressions, and attempts to extract a List of
Lists of |
|
static java.util.List<java.lang.String> |
evaluateList(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.util.List<java.lang.String> def)
Evaluates the given text, which may have embedded Expressions, and attempts to extract a List out
of the result, parsing a delimited list to create a list if necessary. |
|
static int |
evaluateNonNegativeInt(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.lang.String attrName,
int def)
Evaluates the given text, which may have embedded Expressions, and attempts to extract an integer value from
the result, calling toString() on the result and parsing it
if necessary. |
|
static int |
evaluateNonZeroInt(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.lang.String attrName,
int def)
Evaluates the given text, which may have embedded Expressions, and attempts to extract an integer value from
the result, calling toString() on the result and parsing it
if necessary. |
|
static
|
evaluateObject(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.lang.String attrName,
java.lang.Class<T> expectedClass,
T def)
Evaluates the given text, which may have embedded Expressions, and attempts to extract a result, and cast it
to the same class as the given expected class. |
|
static
|
evaluateObject(java.lang.String text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.lang.String attrName,
java.lang.Class<T> expectedClass,
T def)
Evaluates the given text, which may have embedded Expressions, and attempts to extract a result, and cast it
to the same class as the given expected class. |
|
static int |
evaluatePositiveInt(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.lang.String attrName,
int def)
Evaluates the given text, which may have embedded Expressions, and attempts to extract an integer value from
the result, calling toString() on the result and parsing it
if necessary. |
|
static java.lang.Object |
evaluateRichTextString(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
org.apache.poi.ss.usermodel.CreationHelper helper,
java.lang.Object def)
Evaluates the given RichTextString text, which may have
embedded Expressions, and attempts to extract a
RichTextString result. |
|
static java.lang.String |
evaluateString(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.lang.String def)
Evaluates the given text, which may have embedded Expressions, and attempts to extract a String
result, calling toString() on the result. |
|
static java.lang.String |
evaluateStringNotNull(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.lang.String attrName,
java.lang.String def)
Evaluates the given text, which may have embedded Expressions, and attempts to extract a String
result, calling toString() on the result. |
|
static java.lang.String |
evaluateStringSpecificValues(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.lang.String attrName,
java.util.List<java.lang.String> legalValues,
java.lang.String def)
Evaluates the given text, which may have embedded Expressions, and attempts to extract a String
result, calling toString() on the result. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String SPEC_SEP
public static final java.lang.String SPEC_SEP_2
[[0, 1], [2, 3]].
| Constructor Detail |
|---|
public AttributeUtil()
| Method Detail |
|---|
public static boolean evaluateBoolean(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
boolean def)
Expressions, and attempts to extract a boolean value from
the result, calling Boolean.parseBoolean() on the result if
necessary. If the text is null, then the result defaults to the given
default boolean value.
text - Text which may have embedded Expressions.beans - A Map of bean names to bean values.def - The default value if the text is null.
public static int evaluateInt(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.lang.String attrName,
int def)
Expressions, and attempts to extract an integer value from
the result, calling toString() on the result and parsing it
if necessary. If the text is null, then the result defaults to the given
default integer value.
text - Text which may have embedded Expressions.beans - A Map of bean names to bean values.attrName - The attribute name. This is only used when constructing
an exception message.def - The default value if the text is null.
TagParseException - If the result of the evaluation of the text is
not a number.
public static int evaluateNonNegativeInt(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.lang.String attrName,
int def)
Expressions, and attempts to extract an integer value from
the result, calling toString() on the result and parsing it
if necessary. Enforce the result to be non-negative.
text - Text which may have embedded Expressions.beans - A Map of bean names to bean values.attrName - The attribute name. This is only used when constructing
an exception message.def - The default value if the text is null.
TagParseException - If the result of the evaluation of the text is
not a number, or if the result is negative.
public static int evaluatePositiveInt(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.lang.String attrName,
int def)
Expressions, and attempts to extract an integer value from
the result, calling toString() on the result and parsing it
if necessary. Enforce the result to be positive.
text - Text which may have embedded Expressions.beans - A Map of bean names to bean values.attrName - The attribute name. This is only used when constructing
an exception message.def - The default value if the text is null.
TagParseException - If the result of the evaluation of the text is
not a number, or if the result is negative.
public static int evaluateNonZeroInt(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.lang.String attrName,
int def)
Expressions, and attempts to extract an integer value from
the result, calling toString() on the result and parsing it
if necessary. Enforce the result to be not zero.
text - Text which may have embedded Expressions.beans - A Map of bean names to bean values.attrName - The attribute name. This is only used when constructing
an exception message.def - The default value if the text is null.
TagParseException - If the result of the evaluation of the text is
not a number, or if the result is zero.
public static double evaluateDouble(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.lang.String attrName,
double def)
Expressions, and attempts to extract a double value from
the result, calling toString() on the result and parsing it
if necessary.
text - Text which may have embedded Expressions.beans - A Map of bean names to bean values.attrName - The attribute name. This is only used when constructing
an exception message.def - The default value if the text is null.
TagParseException - If the result of the evaluation of the text is
not a number.
public static java.lang.String evaluateString(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.lang.String def)
Expressions, and attempts to extract a String
result, calling toString() on the result.
text - Text which may have embedded Expressions.beans - A Map of bean names to bean values.def - The default value if the text is null.
String result.
public static java.lang.String evaluateStringNotNull(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.lang.String attrName,
java.lang.String def)
Expressions, and attempts to extract a String
result, calling toString() on the result.
text - Text which may have embedded Expressions.beans - A Map of bean names to bean values.attrName - The attribute name. This is only used when constructing
an exception message.def - The default value if the text is null.
String result.
public static java.lang.String evaluateStringSpecificValues(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.lang.String attrName,
java.util.List<java.lang.String> legalValues,
java.lang.String def)
Expressions, and attempts to extract a String
result, calling toString() on the result. Enforces that the
result is one of the given expected values, ignoring case.
text - Text which may have embedded Expressions.beans - A Map of bean names to bean values.attrName - The attribute name. This is only used when constructing
an exception message.legalValues - A List of expected values.def - The default value if the text is null.
String result.
TagParseException - If the result isn't one of the expected legal
values.
public static java.lang.Object evaluateRichTextString(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
org.apache.poi.ss.usermodel.CreationHelper helper,
java.lang.Object def)
RichTextString text, which may have
embedded Expressions, and attempts to extract a
RichTextString result.
text - Text which may have embedded Expressions.beans - A Map of bean names to bean values.helper - A POI CreationHelperdef - The default value if the text is null.
public static <T> T evaluateObject(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.lang.String attrName,
java.lang.Class<T> expectedClass,
T def)
Expressions, and attempts to extract a result, and cast it
to the same class as the given expected class.
text - Text which may have embedded Expressions.beans - A Map of bean names to bean values.attrName - The attribute name. This is only used when constructing
an exception message.expectedClass - The result is expected to be of the given class or
of a subclass.def - The default value if the text is null.
TagParseException - If the result is not of the expected class or
of a subclass.
public static <T> T evaluateObject(java.lang.String text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.lang.String attrName,
java.lang.Class<T> expectedClass,
T def)
Expressions, and attempts to extract a result, and cast it
to the same class as the given expected class.
text - Text which may have embedded Expressions.beans - A Map of bean names to bean values.attrName - The attribute name. This is only used when constructing
an exception message.expectedClass - The result is expected to be of the given class or
of a subclass.def - The default value if the text is null.
TagParseException - If the result is not of the expected class or
of a subclass.
public static java.util.List<java.lang.String> evaluateList(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.util.List<java.lang.String> def)
Expressions, and attempts to extract a List out
of the result, parsing a delimited list to create a list if necessary.
text - Text which may have embedded Expressions.beans - A Map of bean names to bean values.def - The default value if the text is null.
List.
public static java.util.List<java.lang.Integer> evaluateIntegerArray(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.util.List<java.lang.Integer> def)
Evaluates the given text, which may have embedded
Expressions, and attempts to extract a List of
Integers from the result, accepting an int
array or a Collection or delimited list of numbers.
Examples of proper input:
text - Text which may have embedded Expressions.beans - A Map of bean names to bean values.def - The default value if the text is null.
List of Integers.
public static java.util.List<java.util.List<java.lang.Integer>> evaluateIntegerArrayArray(org.apache.poi.ss.usermodel.RichTextString text,
java.util.Map<java.lang.String,java.lang.Object> beans,
java.util.List<java.util.List<java.lang.Integer>> def)
Evaluates the given text, which may have embedded
Expressions, and attempts to extract a List of
Lists of Integers from the result, accepting a
2D int array or a Collection of
Collections or delimited list of numbers.
Examples of proper input:
text - Text which may have embedded Expressions.beans - A Map of bean names to bean values.def - The default value if the text is null.
List of Lists of
Integers.
public static void ensureExactlyOneExists(java.util.List<org.apache.poi.ss.usermodel.RichTextString> attrValues,
java.util.List<java.lang.String> attrNames)
attrValues - A List of attribute values.attrNames - A List of attribute names.
TagParseException - If none of the attribute values is not null, or
if more than one attribute value is not null.
public static void ensureAtMostOneExists(java.util.List<org.apache.poi.ss.usermodel.RichTextString> attrValues,
java.util.List<java.lang.String> attrNames)
attrValues - A List of attribute values.attrNames - A List of attribute names.
TagParseException - If more than one of the attribute values is not
null.
public static void ensureAtLeastOneExists(java.util.List<org.apache.poi.ss.usermodel.RichTextString> attrValues,
java.util.List<java.lang.String> attrNames)
attrValues - A List of attribute values.attrNames - A List of attribute names.
TagParseException - If all of the attribute values are null.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||