public class ConfigProcessor
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.HashMap<java.lang.String,rasmus_torkel.config.ConfigParam> |
_nameToParam |
protected java.util.ArrayList<rasmus_torkel.config.ConfigParam> |
_paramAl |
protected static java.util.regex.Pattern |
_paramPattern |
PropertySourceDescription |
_sourceDesc |
Constructor and Description |
---|
ConfigProcessor(PropertySourceDescription sourceDesc) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
evaluateExpression(java.lang.String expression,
java.io.File file,
int lineNr)
Evaluates and expression to an actual value.
|
java.lang.String |
getValue(java.lang.String name)
If you really want, you can retrieve the value directly from this class instead of
retrieving the properties first.
|
java.lang.String |
makeAnnotatedConfigString()
This method blends the functionality of
makeConfigString() and makeTrace() . |
java.lang.String |
makeConfigString()
Makes a configuration string that encapsulates the final state of all properties.
|
java.util.Properties |
makeProperties()
Makes a properties object representing the configuration.
|
PropertiesView |
makePropertiesView()
Gives a representation of the configuration in the author's preferred format for
actually extracting data out of it.
|
java.lang.String |
makeTrace()
Returns a string that describes all assignments to the properties including superseded ones.
|
protected boolean |
tryParam(java.lang.String line,
java.io.File file,
int lineNr) |
protected java.util.ArrayList<rasmus_torkel.config.ConfigParam> _paramAl
protected java.util.HashMap<java.lang.String,rasmus_torkel.config.ConfigParam> _nameToParam
public final PropertySourceDescription _sourceDesc
protected static final java.util.regex.Pattern _paramPattern
public ConfigProcessor(PropertySourceDescription sourceDesc)
protected boolean tryParam(java.lang.String line, java.io.File file, int lineNr) throws ConfigSyntaxException
ConfigSyntaxException
public java.lang.String evaluateExpression(java.lang.String expression, java.io.File file, int lineNr) throws ConfigSyntaxException
expression
- The expression to evaluatefile
- The file the expression came from (used only for exceptions)lineNr
- The line number of the expression within the file (used only for exceptions)ConfigSyntaxException
public java.lang.String getValue(java.lang.String name)
name
- public java.util.Properties makeProperties()
makePropertiesView()
to get a more useful PropertiesView
object.public PropertiesView makePropertiesView()
public java.lang.String makeConfigString()
public java.lang.String makeTrace()
public java.lang.String makeAnnotatedConfigString()
makeConfigString()
and makeTrace()
.
If written to a file, the file would be a valid configuration file. Superseded assignments
are included as comments. It is however not as easy to read as makeConfigString()
and makeTrace()
.