org.apache.maven.doxia.parser
Class AbstractParser

java.lang.Object
  extended by org.apache.maven.doxia.parser.AbstractParser
All Implemented Interfaces:
Parser
Direct Known Subclasses:
AbstractTextParser, AbstractXmlParser

public abstract class AbstractParser
extends Object
implements Parser

An abstract base class that defines some convenience methods for parsers. Provides a macro mechanism to give dynamic functionalities for the parsing.

Since:
1.0
Version:
$Id: AbstractParser.java 564180 2007-08-09 12:15:44Z vsiveton $
Author:
Jason van Zyl

Field Summary
protected  MacroManager macroManager
           
protected  boolean secondParsing
          Indicates that a second parsing is required.
 
Fields inherited from interface org.apache.maven.doxia.parser.Parser
JUSTIFY_CENTER, JUSTIFY_LEFT, JUSTIFY_RIGHT, ROLE, TXT_TYPE, UNKNOWN_TYPE, XML_TYPE
 
Constructor Summary
AbstractParser()
           
 
Method Summary
 void executeMacro(String macroId, MacroRequest request, Sink sink)
          Execute a macro on the given sink.
protected  File getBasedir()
          Returns the current base directory.
 int getType()
          The parser type value could be Parser.UNKNOWN_TYPE, Parser.TXT_TYPE or Parser.XML_TYPE.
 void setSecondParsing(boolean second)
          Set secondParsing to true, if we need a second parsing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.maven.doxia.parser.Parser
parse
 

Field Detail

secondParsing

protected boolean secondParsing
Indicates that a second parsing is required.


macroManager

protected MacroManager macroManager
Constructor Detail

AbstractParser

public AbstractParser()
Method Detail

getType

public int getType()
The parser type value could be Parser.UNKNOWN_TYPE, Parser.TXT_TYPE or Parser.XML_TYPE.

Specified by:
getType in interface Parser
Returns:
the type of Parser

executeMacro

public void executeMacro(String macroId,
                         MacroRequest request,
                         Sink sink)
                  throws MacroExecutionException,
                         MacroNotFoundException
Execute a macro on the given sink.

Parameters:
macroId - An id to lookup the macro.
request - The corresponding MacroRequest.
sink - The sink to receive the events.
Throws:
MacroExecutionException - if an error occurred during execution.
MacroNotFoundException - if the macro could not be found.

getBasedir

protected File getBasedir()
Returns the current base directory.

Returns:
The base directory.

setSecondParsing

public void setSecondParsing(boolean second)
Set secondParsing to true, if we need a second parsing.

Parameters:
second - True for second parsing.


Copyright © 2005-2011 Apache Software Foundation. All Rights Reserved.