org.jplate.kvp.parser.impl.defaults
Class DefaultKvpMapBuilder

java.lang.Object
  extended by org.jplate.kvp.parser.impl.defaults.DefaultKvpMapBuilder
All Implemented Interfaces:
BuilderIfc<java.util.Map<java.lang.String,java.lang.String>>, JPlateBuilderIfc<java.util.Map<java.lang.String,java.lang.String>>, JPlateMapBuilderIfc<java.lang.String,java.lang.String>, KvpBuilderIfc<java.util.Map<java.lang.String,java.lang.String>>, KvpMapBuilderIfc

public class DefaultKvpMapBuilder
extends java.lang.Object
implements KvpMapBuilderIfc

Kvp builder that constructs Map's containing String name/value pairs.

Modifications:
    $Date: 2008-12-02 12:32:45 -0500 (Tue, 02 Dec 2008) $
    $Revision: 479 $
    $Author: sfloess $
    $HeadURL: https://jplate.svn.sourceforge.net/svnroot/jplate/trunk/src/dev/java/org/jplate/kvp/parser/impl/defaults/DefaultKvpMapBuilder.java $
    


Field Summary
private  org.apache.commons.logging.Log _log
          Used for logging.
private  MapFactoryIfc<java.lang.String,java.lang.String> _mapFactory
          Used to create Map's.
private  java.util.Map<java.lang.String,java.lang.String> _mapResult
          Holds the result.
 
Constructor Summary
DefaultKvpMapBuilder()
          Default constructor.
DefaultKvpMapBuilder(MapFactoryIfc<java.lang.String,java.lang.String> mapFactory)
          This constructor sets the map factory that is use to hold name/value pairs.
 
Method Summary
 void buildEnd(int line, int column)
          This method is called when parsing has completed.
 void buildKeyValuePair(KvpParseContextIfc parseContext)
          This method is called when key / value pairs have been parsed.
 void buildStart()
          This method is called when parsing is to begin.
 java.util.Map<java.lang.String,java.lang.String> getResult()
          Return the built object.
 void reset()
          Reset any result currently held.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_mapFactory

private final MapFactoryIfc<java.lang.String,java.lang.String> _mapFactory
Used to create Map's.


_mapResult

private java.util.Map<java.lang.String,java.lang.String> _mapResult
Holds the result.


_log

private final transient org.apache.commons.logging.Log _log
Used for logging.

Constructor Detail

DefaultKvpMapBuilder

public DefaultKvpMapBuilder(MapFactoryIfc<java.lang.String,java.lang.String> mapFactory)
This constructor sets the map factory that is use to hold name/value pairs.

Parameters:
mapFactory - Factory to create a map that will be used to hold the name/value pairs.

DefaultKvpMapBuilder

public DefaultKvpMapBuilder()
Default constructor. The map factory created is UnsynchronizedHashMapFactory.

Method Detail

getResult

public java.util.Map<java.lang.String,java.lang.String> getResult()
Return the built object.

Specified by:
getResult in interface BuilderIfc<java.util.Map<java.lang.String,java.lang.String>>
Returns:
the built object.

reset

public void reset()
Reset any result currently held.

Specified by:
reset in interface BuilderIfc<java.util.Map<java.lang.String,java.lang.String>>

buildStart

public void buildStart()
                throws JPlateBuildingException
This method is called when parsing is to begin.

Specified by:
buildStart in interface JPlateBuilderIfc<java.util.Map<java.lang.String,java.lang.String>>
Throws:
JPlateBuildingException

buildEnd

public void buildEnd(int line,
                     int column)
              throws JPlateBuildingException
This method is called when parsing has completed.

Specified by:
buildEnd in interface JPlateBuilderIfc<java.util.Map<java.lang.String,java.lang.String>>
Parameters:
line - The line where parsing ended.
column - The column number where parsing ended.
Throws:
JPlateBuildingException

buildKeyValuePair

public void buildKeyValuePair(KvpParseContextIfc parseContext)
                       throws JPlateBuildingException
This method is called when key / value pairs have been parsed.

Specified by:
buildKeyValuePair in interface KvpBuilderIfc<java.util.Map<java.lang.String,java.lang.String>>
Parameters:
parseContext - contains data about the parsed key/value pair.
Throws:
JPlateBuildingException - If there is a problem building the key / value pair.