consciouscode.seedling.config.properties
Class PropertiesConfigEvaluator

java.lang.Object
  extended by consciouscode.seedling.config.properties.PropertiesConfigEvaluator
All Implemented Interfaces:
ConfigEvaluator

public class PropertiesConfigEvaluator
extends Object
implements ConfigEvaluator

Evaluates the content of .properties configuration files.

The given ConfigEvaluatorContext has a precondition that the result of ConfigEvaluatorContext.getConfigResource() returns a PropertiesConfigResource.


Field Summary
static String DOT_CHILDREN_PROP
           
static String DOT_THIS_PROP
           
static char DOUBLE_QUOTE_CHAR
           
static String DOUBLE_QUOTE_STRING
           
protected  boolean isTransitional
          Indicates if this evaluator allows backwards-compatible expressions.
 
Fields inherited from interface consciouscode.seedling.config.ConfigEvaluator
NO_VALUE
 
Constructor Summary
PropertiesConfigEvaluator()
           
PropertiesConfigEvaluator(ClassLoader nodeClassLoader)
           
 
Method Summary
 Object constructNode(ConstructionContext context)
          Creates a new node, ready for injection and decoration.
static String describeToken(StreamTokenizer tokenizer)
           
 EvaluationResult evalNextExpression(consciouscode.seedling.config.properties.EvaluationContext context, consciouscode.seedling.config.properties.Tokenizer tokenizer)
           
 Object evaluateProperty(PropertyEvaluationContext context, String property, Class<?> propertyType)
          Evaluates the configuration of a property.
 ConfigResource getInnerConfig(ConfigResource config, Iterable<String> pathParts)
           
 boolean isTransitional()
           
 void setTransitional(boolean transitional)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOT_THIS_PROP

public static final String DOT_THIS_PROP
See Also:
Constant Field Values

DOT_CHILDREN_PROP

public static final String DOT_CHILDREN_PROP
See Also:
Constant Field Values

DOUBLE_QUOTE_CHAR

public static final char DOUBLE_QUOTE_CHAR
See Also:
Constant Field Values

DOUBLE_QUOTE_STRING

public static final String DOUBLE_QUOTE_STRING
See Also:
Constant Field Values

isTransitional

protected boolean isTransitional
Indicates if this evaluator allows backwards-compatible expressions.

Constructor Detail

PropertiesConfigEvaluator

public PropertiesConfigEvaluator()

PropertiesConfigEvaluator

public PropertiesConfigEvaluator(ClassLoader nodeClassLoader)
Method Detail

isTransitional

public boolean isTransitional()

setTransitional

public void setTransitional(boolean transitional)

getInnerConfig

public ConfigResource getInnerConfig(ConfigResource config,
                                     Iterable<String> pathParts)
                              throws ConfigurationException
Specified by:
getInnerConfig in interface ConfigEvaluator
Throws:
ConfigurationException

constructNode

public Object constructNode(ConstructionContext context)
                     throws NodeProvisioningException
Description copied from interface: ConfigEvaluator
Creates a new node, ready for injection and decoration.

If the evaluator cannot construct the new node, implementations may delegate to super-configuration resources via ConstructionContext.superConstructNode(). If it does so, this method should not return null, since that causes the framework to do the delegation again.

To provision an alias, this method should return a NodeReference to the target node.

Specified by:
constructNode in interface ConfigEvaluator
Returns:
the result of the creation configuration, or null if there's no creation configured in this layer, or ConfigEvaluator.NO_VALUE if creation is explicitly disabled.
Throws:
NodeProvisioningException

evaluateProperty

public Object evaluateProperty(PropertyEvaluationContext context,
                               String property,
                               Class<?> propertyType)
                        throws PropertyEvaluationException
Description copied from interface: ConfigEvaluator
Evaluates the configuration of a property. The configuration resource is provided by the context. If the evaluator and/or the resource cannot provide a definitive value for the property, implementations must generally delegate to prior configuration resources via PropertyEvaluationContext.superEvaluateProperty(java.lang.String, java.lang.Class).

Specified by:
evaluateProperty in interface ConfigEvaluator
Returns:
ConfigEvaluator.NO_VALUE if there's no result.
Throws:
PropertyEvaluationException - if anything goes wrong while evaluating the property.

evalNextExpression

public EvaluationResult evalNextExpression(consciouscode.seedling.config.properties.EvaluationContext context,
                                           consciouscode.seedling.config.properties.Tokenizer tokenizer)
                                    throws SyntaxException,
                                           EvaluationException
Returns:
null if the expression has no value. For example, 'super' with no inherited configuration.
Throws:
SyntaxException
EvaluationException

describeToken

public static String describeToken(StreamTokenizer tokenizer)


Copyright © 2001–2012 Todd V. Jonker. All Rights Reserved.