|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.christopherschultz.evaluator.util.ConstantLoader
public class ConstantLoader
Utility class to help load constants, functions, and properties for an EvaluationContext.
| Field Summary | |
|---|---|
static String |
BLANK_NULL
A Boolean property that, when set to true, will cause
blank strings to return null from getValue(java.lang.String)
instead of an empty string. |
| Constructor Summary | |
|---|---|
ConstantLoader()
Creates a new ConstantLoader. |
|
| Method Summary | |
|---|---|
Object |
getObject(String className)
|
Object |
getProperty(String name)
Gets the value of the specified property. |
String |
getPropertyName(String propertyName)
Deprecated. This method is confusing at best. It's basically just a cast. |
Object |
getValue(String valueStr)
Converts a String into a value object. |
Object |
newObjectInstance(String className)
|
void |
setProperty(String name,
Object value)
Sets a ConstantLoader property. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String BLANK_NULL
true, will cause
blank strings to return null from getValue(java.lang.String)
instead of an empty string.
setProperty(java.lang.String, java.lang.Object),
getProperty(java.lang.String)| Constructor Detail |
|---|
public ConstantLoader()
| Method Detail |
|---|
public void setProperty(String name,
Object value)
name - The name of the property.value - The value of the property.public Object getProperty(String name)
name - The name of the property.
null
if that property has not been set to a specific value.public String getPropertyName(String propertyName)
public Object newObjectInstance(String className)
public Object getObject(String className)
public Object getValue(String valueStr)
| Rule | Resulting Object Type | Example |
|---|---|---|
Value is 'null' null (or "" (empty string) if BLANK_NULL is true) |
null | null |
| Value is surrounded by ' or " characters. | String | "1.0", 'what (if any)', "null" |
| Value contains '#' | (depends) | java.lang.Boolean#TRUE, java.lang.Integer#MAX_VALUE |
| Value contains '(' | (depends) | java.lang.Integer(3) |
| Value is 'true' or 'false' (case insensitive). | java.lang.Boolean | 'true' or 'false' |
| Value contains numbers including a '.' (or ends with 'd') (optional sign) | java.lang.Double | 3.14159, 100d, 0.5, -2.0 |
| Value contains numbers and ends with 'f' (optional sign) | java.lang.Float | 3.14159f, 100f, -2f |
| Value contains digits only (optional sign) | java.lang.Integer | 2145, -40, 908 |
| Value contains digits only and ends with 'l' (optional sign) | java.lang.Long | 2145l, -40l, 908l |
| (all others) | java.lang.String | (anything else) |
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||