org.gcn.plinguacore.parser
Class AbstractParserFactory

java.lang.Object
  extended by org.gcn.plinguacore.parser.AbstractParserFactory
Direct Known Subclasses:
InputParserFactory, OutputParserFactory

public abstract class AbstractParserFactory
extends java.lang.Object

This class is intended to be extended by InputParserFactory and OutputParserFactory

Author:
Research Group on Natural Computing (http://www.gcn.us.es)

Constructor Summary
AbstractParserFactory()
          Creates a new AbstractParserFactory instance
 
Method Summary
 IParser createInputParserThroughExtension(java.lang.String fileExtension)
          Looks if there's any input format whose files correspond to the extension given and returns an input format which parses that format
 IParser createParser(java.lang.String formatName)
          Creates a IParser instance according to the given format
static IParsersInfo getParserInfo()
          Return general information about available parsers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractParserFactory

public AbstractParserFactory()
Creates a new AbstractParserFactory instance

Method Detail

getParserInfo

public static final IParsersInfo getParserInfo()
Return general information about available parsers

Returns:
an IParsersInfo instance with general information about available parsers

createParser

public final IParser createParser(java.lang.String formatName)
                           throws PlinguaCoreException
Creates a IParser instance according to the given format

Parameters:
className - the format name of the parser to create
Returns:
a proper IParser instance according to the given format
Throws:
PlinguaCoreException - if the format is not supported

createInputParserThroughExtension

public IParser createInputParserThroughExtension(java.lang.String fileExtension)
                                          throws PlinguaCoreException
Looks if there's any input format whose files correspond to the extension given and returns an input format which parses that format

Parameters:
fileExtension - the extension which input format class name should be returned
Returns:
the input format instance which corresponds to the file extension given
Throws:
PlinguaCoreException - if there's no recognized input parser for the extension given