com.pietschy.command.configuration.impl
Class FaceAttributeParser

java.lang.Object
  extended by com.pietschy.command.configuration.impl.FaceAttributeParser
Direct Known Subclasses:
FaceExtendsAttributeParser, FaceTextAttributeParser, InheritedAttributeParser

abstract class FaceAttributeParser
extends java.lang.Object

The base class for all Face Attribute parsers.


Constructor Summary
protected FaceAttributeParser(java.lang.String... properties)
          Creates a new instance for the specified properties.
 
Method Summary
 java.lang.String[] getProperties()
          Gets the properties this parser is handling.
 void parse(java.lang.String propertyName, java.lang.String value, Face face, ExceptionFactory factory)
          Invoked to parse the specified property and update the specified face.
abstract  void parseEmptyImpl(java.lang.String propertyName, Face face, ExceptionFactory factory)
          Invoked to parse empty property values.
protected abstract  void parseImpl(java.lang.String propertyName, java.lang.String value, Face face, ExceptionFactory factory)
          Invoked to parse non empty property values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FaceAttributeParser

protected FaceAttributeParser(java.lang.String... properties)
Creates a new instance for the specified properties. The property names are those defined in the configuration file. Thus the "text" property parser will handle all properties of the editor command@face.text=_File.

Parsers can be configured to handle multiple properties. An example would be icon parsers where there are many icon types but they are all handled identically.

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

parse

public final void parse(java.lang.String propertyName,
                        java.lang.String value,
                        Face face,
                        ExceptionFactory factory)
                 throws ParseException
Invoked to parse the specified property and update the specified face. This method simply determines if the value is empty and invokes either parseImpl(String, String, Face, ExceptionFactory) or parseEmptyImpl(String, Face, ExceptionFactory) appropriately.

Parameters:
propertyName - the property name being parsed.
value - the property value.
face - the face to be configured.
factory - the exception factory.
Throws:
ParseException - if there was an error parsing the property.

parseImpl

protected abstract void parseImpl(java.lang.String propertyName,
                                  java.lang.String value,
                                  Face face,
                                  ExceptionFactory factory)
                           throws ParseException
Invoked to parse non empty property values.

Parameters:
propertyName - the property name.
value - the property value.
face - the face to configure.
factory - the exception factory.
Throws:
ParseException - if there was an error parsing the property.

parseEmptyImpl

public abstract void parseEmptyImpl(java.lang.String propertyName,
                                    Face face,
                                    ExceptionFactory factory)
                             throws ParseException
Invoked to parse empty property values.

Parameters:
propertyName - the property name.
face - the face to configure.
factory - the exception factory to use.
Throws:
ParseException - if there was an error parsing the property.

getProperties

public java.lang.String[] getProperties()
Gets the properties this parser is handling.

Returns:
the properties this parser is handling.


Copyright © 2006 - 2007 Andrew Pietsch