org.oddjob.arooa.design
Class DesignParser

java.lang.Object
  extended by org.oddjob.arooa.design.DesignParser
All Implemented Interfaces:
ArooaParser, DesignNotifier

public class DesignParser
extends Object
implements ArooaParser, DesignNotifier

Parses a configuration to create a DesignInstance.

The Design is created using a DesignFactory. If one is not provided a default factory is used which will first check the ElementMappings of the sessions ArooaDescriptor for a one. If none exists it will provide one that will dynamically create a design from the properties of the class as derived from the element and the mappings.

Author:
rob

Constructor Summary
DesignParser()
          Default Constructor.
DesignParser(ArooaSession existingSession)
          Create a DesignParser with the given session.
DesignParser(ArooaSession existingSession, DesignFactory factory)
          Create a DesignParser with the given session and factory.
DesignParser(DesignFactory factory)
          Create a DesignParser for the standard session and given factory.
 
Method Summary
 void addDesignListener(DesignListener listener)
          Add a listener.
 ArooaType getArooaType()
          Is this the design of a Value or a Component?
 DesignInstance getDesign()
          Getter for the current DesignInstance.
 ArooaElement getExpectedDocumentElement()
          Getter for the expected document element.
 ConfigurationHandle parse(ArooaConfiguration configuration)
          Parse an ArooaConfiguration.
 void removeDesignListener(DesignListener listener)
          Remove a listener.
 void setArooaType(ArooaType type)
          Set if this is the design of a Value or a Component.
 void setExpectedDoucmentElement(ArooaElement element)
          Setter for expected document element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DesignParser

public DesignParser()
Default Constructor. Creates a DesignParser with a StandardArooaSession, and a default factory.


DesignParser

public DesignParser(ArooaSession existingSession)
Create a DesignParser with the given session.

Parameters:
existingSession - A session. If null the standard will be used.

DesignParser

public DesignParser(DesignFactory factory)
Create a DesignParser for the standard session and given factory.

Parameters:
factory - The factory.

DesignParser

public DesignParser(ArooaSession existingSession,
                    DesignFactory factory)
Create a DesignParser with the given session and factory.

Parameters:
existingSession - A Session. If null the standard will be used.
factory - A factory. If null a default will be used.
Method Detail

addDesignListener

public void addDesignListener(DesignListener listener)
Description copied from interface: DesignNotifier
Add a listener. Before this method returns the listener will have received the events required to match the state of the design.

Specified by:
addDesignListener in interface DesignNotifier
Parameters:
listener - The listener.

removeDesignListener

public void removeDesignListener(DesignListener listener)
Description copied from interface: DesignNotifier
Remove a listener.

Specified by:
removeDesignListener in interface DesignNotifier
Parameters:
listener - The listener.

parse

public ConfigurationHandle parse(ArooaConfiguration configuration)
                          throws ArooaParseException
Description copied from interface: ArooaParser
Parse an ArooaConfiguration.

Specified by:
parse in interface ArooaParser
Parameters:
configuration - The configuration.
Returns:
A ConfigurationHandle.
Throws:
ArooaParseException - If parsing fails.

getDesign

public DesignInstance getDesign()
Getter for the current DesignInstance.

Returns:

getArooaType

public ArooaType getArooaType()
Is this the design of a Value or a Component?

Returns:

setArooaType

public void setArooaType(ArooaType type)
Set if this is the design of a Value or a Component.

Parameters:
component - True if this is a Component Design.

getExpectedDocumentElement

public ArooaElement getExpectedDocumentElement()
Getter for the expected document element.

Returns:
The expected ArooaElement. Null if it can be anything.

setExpectedDoucmentElement

public void setExpectedDoucmentElement(ArooaElement element)
Setter for expected document element.

Parameters:
element - The expected document element. Can be null if element can be anything.