com.pietschy.command.configuration.impl
Class InheritedAttributeParser

java.lang.Object
  extended by com.pietschy.command.configuration.impl.FaceAttributeParser
      extended by com.pietschy.command.configuration.impl.InheritedAttributeParser
Direct Known Subclasses:
FaceAcceleratorAttributeParser, FaceBooleanAttributeParser, FaceHorizontalTextPositionParser, FaceIconAttributeParser, FaceIntegerAttributeParser, FaceStringAttributeParser, FaceVerticalTextPositionParser

abstract class InheritedAttributeParser
extends FaceAttributeParser

Provides the standard implementation for all parsers that parse inherited values. This class ensures the empty values turn off inheritance for the specified attribute.


Constructor Summary
protected InheritedAttributeParser(java.lang.String... properties)
          Creates a new parser that will handle the specified attribute names.
 
Method Summary
 void parseEmptyImpl(java.lang.String key, Face face, ExceptionFactory factory)
          Parses empty property values.
protected  void parseImpl(java.lang.String key, java.lang.String value, Face face, ExceptionFactory factory)
          Parsers the specified key and value and updates the specified face.
protected abstract  java.lang.Object parseValue(java.lang.String propertyName, java.lang.String value, ExceptionFactory factory)
          Abstract method to be implemented by subclasses to parse the actual value.
 
Methods inherited from class com.pietschy.command.configuration.impl.FaceAttributeParser
getProperties, parse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InheritedAttributeParser

protected InheritedAttributeParser(java.lang.String... properties)
Creates a new parser that will handle the specified attribute names.

Parameters:
properties - the property names this parser handles.
Method Detail

parseImpl

protected void parseImpl(java.lang.String key,
                         java.lang.String value,
                         Face face,
                         ExceptionFactory factory)
                  throws ParseException
Parsers the specified key and value and updates the specified face. This method retrieves the appropriate AttributeValue from the face and configures its value. The value is parsed using parseValue(String, String, ExceptionFactory).

Specified by:
parseImpl in class FaceAttributeParser
Parameters:
key - the property key
value - the property value.
face - the face to update.
factory - the exception factory to use.
Throws:
ParseException - if there was an error parsing the value.

parseValue

protected abstract java.lang.Object parseValue(java.lang.String propertyName,
                                               java.lang.String value,
                                               ExceptionFactory factory)
                                        throws java.lang.Exception
Abstract method to be implemented by subclasses to parse the actual value.

Parameters:
propertyName - the property name.
value - the proerty value
factory - the exception factory to use.
Returns:
the parsed value.
Throws:
java.lang.Exception - if there was an error parsing the value.

parseEmptyImpl

public void parseEmptyImpl(java.lang.String key,
                           Face face,
                           ExceptionFactory factory)
Parses empty property values. This method simply retrieves the appropriate face attribute, sets the value to null and updates the inherited flag to false.

Specified by:
parseEmptyImpl in class FaceAttributeParser
Parameters:
key - the property key.
face - the face to configure.
factory - the exception factory to use.


Copyright © 2006 - 2007 Andrew Pietsch