Class ExprProps
- All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>
ExprProps is a subclass of Properties that
is "smart" in the sense that it wraps a Calculator
object, passing get and getProperty keys to
the Calculator for processing.
Keys are first searched for in the Properties
object. If not found, the key is passed to the getValue
method of the wrapped Calculator object. The
Calculator will return null if the key
consists of only a name or Brazil token and that name/token evaluates
to 0. In this case, a value associated with the key can not be
"found" and the get or getpropertymethod returns
null also.
Only property names that "look" like expressions (e.g. contain at least one of characters in [invalid input: '&'|*+/%=!invalid input: '<'>-]) are passed to the calculator.
- Version:
- 2.3, 04/05/24
- Author:
- Steve Drach <drach@sun.com>
- See Also:
-
Field Summary
Fields inherited from class Properties
defaults -
Constructor Summary
ConstructorsConstructorDescriptionThis constructor creates aCalculatorinstance with this instance ofExprPropsas it's symbol table.ExprProps(Properties defaults) This constructor creates aCalculatorinstance with this instance ofExprPropsas it's symbol table and with thePropertiesinstance referenced by the parameterdefaultsas it's set of default values.This constructor creates aCalculatorinstance withrequest.propsas it's symbol table.ExprProps(Request request, Properties defaults) This constructor creates aCalculatorinstance withrequest.propsas it's symbol table and with thePropertiesinstance referenced by the parameterdefaultsas it's set of default values. -
Method Summary
Methods inherited from class Properties
clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, getOrDefault, getProperty, hashCode, isEmpty, keys, keySet, list, list, load, load, loadFromXML, merge, propertyNames, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, save, setProperty, size, store, store, storeToXML, storeToXML, storeToXML, stringPropertyNames, toString, values
-
Constructor Details
-
ExprProps
public ExprProps()This constructor creates aCalculatorinstance with this instance ofExprPropsas it's symbol table. -
ExprProps
This constructor creates aCalculatorinstance with this instance ofExprPropsas it's symbol table and with thePropertiesinstance referenced by the parameterdefaultsas it's set of default values.- Parameters:
defaults- the defaults
-
ExprProps
This constructor creates aCalculatorinstance withrequest.propsas it's symbol table.- Parameters:
request- theRequestinstance
-
ExprProps
This constructor creates aCalculatorinstance withrequest.propsas it's symbol table and with thePropertiesinstance referenced by the parameterdefaultsas it's set of default values.- Parameters:
request- theRequestinstancedefaults- the defaults
-
-
Method Details
-
get
Returns the value to which the specified key is mapped in thisHashtable. If the key is not found, then it's value is computed by treating the key as an arithmetic expression or statement.If, during the computation, an
ArithmeticExceptionis thrown, the keycompute.erroris set in the baseProperties. The value associated with the key is an error message. -
getProperty
Searches for the property with the specified key in this property list. If the key is not found in this property list, then it's value is computed by treating the key as an arithmetic expression or statement.If, during the computation, an
ArithmeticExceptionis thrown, the keycompute.erroris set in the baseProperties. The value associated with the key is an error message.If the result of the computation is
null, the default property list, and its defaults, recursively, are then checked. The method returnsnullif the property is not found.- Overrides:
getPropertyin classProperties- Parameters:
key- the property key- Returns:
- the value in this property list with the
specified key or
null - See Also:
-