olg.csv.bean.loader
Class AbstractFormatterLoader

Package class diagram package AbstractFormatterLoader
java.lang.Object
  extended by olg.csv.bean.loader.AbstractFormatterLoader
Direct Known Subclasses:
AbstractFormatterLoader.CustomFormatterLoader, AbstractFormatterLoader.DateFormatterLoader

public abstract class AbstractFormatterLoader
extends Object

Class dedicated to load a formatter Formatter from an XML element conformed to XML schema FormatterType specification. Each concret class shall have the responsibility to load a concrete Formatter class.

Class based on Chain of responsability pattern and used to chain concret Formatter Loaders.


Nested Class Summary
private static class AbstractFormatterLoader.CustomFormatterLoader
          Class responsible of CustomFormatter loading.
private static class AbstractFormatterLoader.DateFormatterLoader
          Class responsible of DateFormatter loading.
 
Field Summary
private static AbstractFormatterLoader instance
          Singleton instance to use to load Formatter.
protected  AbstractFormatterLoader successor
          FormatterLoader successor as describe in Chain of responsability pattern.
protected  String xPathExpression
          This Xpath expression allows to identify xml node which describe the corresponding concret formatter under formatterType node.
 
Constructor Summary
protected AbstractFormatterLoader(String xPathExpression, AbstractFormatterLoader successor)
           
 
Method Summary
protected abstract  Formatter<?> getConcreteFormatter(Element node)
          Returns a concret formatter.
 Formatter<?> getFormatter(Element element)
          Returns a concret formatter identified from the given XML element.
static AbstractFormatterLoader getInstance()
          Returns singleton responsible of formatters loading.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

private static AbstractFormatterLoader instance
Singleton instance to use to load Formatter.


successor

protected AbstractFormatterLoader successor
FormatterLoader successor as describe in Chain of responsability pattern.


xPathExpression

protected String xPathExpression
This Xpath expression allows to identify xml node which describe the corresponding concret formatter under formatterType node.

Constructor Detail

AbstractFormatterLoader

protected AbstractFormatterLoader(String xPathExpression,
                                  AbstractFormatterLoader successor)
Parameters:
xPathExpression - XPath expression that allows to identify the concret formatter under the XML FormatterType node
successor - following concret loader in the chain of responsability
Method Detail

getInstance

public static AbstractFormatterLoader getInstance()
Returns singleton responsible of formatters loading. This is this instance you have to be used to load every type of formatters from XML element conformed to XML Schema FormatterType specification.

Returns:
the AbstractFormatter loader

getFormatter

public final Formatter<?> getFormatter(Element element)
                                throws XPathExpressionException,
                                       LoadException
Returns a concret formatter identified from the given XML element.

Parameters:
element - XML node corresponding to correspondant to XML FormatterType as described in our XML schema.
Returns:
a concret formatter or null if the given element doesn't match the concret formatter type this loader has responsability and doesn't match any successor
Throws:
XPathExpressionException - on invalid XPathExpression
LoadException - on Error occurs during loading

getConcreteFormatter

protected abstract Formatter<?> getConcreteFormatter(Element node)
                                              throws XPathExpressionException,
                                                     LoadException
Returns a concret formatter.

Parameters:
node - XML Element corresponding to the XPath expression. From this element a concret formatter this loader should return will be extracted
Returns:
a concret formatter this loader has responsability or null if the given node doesn't match the type this loader should return
Throws:
XPathExpressionException - on invalid XPathExpression
LoadException - on Error occurs during loading
See Also:
xPathExpression


Copyright © 2014. All Rights Reserved.