org.jplate.foundation.parser.impl
Class AbstractJPlateMapBuilder<K,V>

java.lang.Object
  extended by org.jplate.foundation.parser.impl.AbstractJPlateMapBuilder<K,V>
Type Parameters:
K - The key type stored in the @{link Map}.
V - The value type stored in the @{link Map}.
All Implemented Interfaces:
BuilderIfc<java.util.Map<K,V>>, JPlateBuilderIfc<java.util.Map<K,V>>, JPlateMapBuilderIfc<K,V>

public abstract class AbstractJPlateMapBuilder<K,V>
extends java.lang.Object
implements JPlateMapBuilderIfc<K,V>

Abstract JPlate builder of Map's. Please note: getResult() returns an unmodifiable map. Additionally, subclasses are left to figure out what JPlateBuilderIfc.buildEnd(int, int) does as a builder may be building information that will need to be processes at the end of a parse.

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/foundation/parser/impl/AbstractJPlateMapBuilder.java $
    


Field Summary
private  org.apache.commons.logging.Log _log
          Used for logging.
private  java.util.Map<K,V> _mapResult
          Holds the result.
 
Constructor Summary
AbstractJPlateMapBuilder()
          Default constructor.
AbstractJPlateMapBuilder(MapFactoryIfc<K,V> mapFactory)
          This constructor sets the map factory that is use to hold name/value pairs.
 
Method Summary
 void buildStart()
          This method is called when parsing is to begin.
protected  java.util.Map<K,V> getActualResultMap()
          This method returns the actual result and is available to subclasses.
 java.util.Map<K,V> 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
 
Methods inherited from interface org.jplate.foundation.parser.JPlateBuilderIfc
buildEnd
 

Field Detail

_mapResult

private java.util.Map<K,V> _mapResult
Holds the result.


_log

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

Constructor Detail

AbstractJPlateMapBuilder

public AbstractJPlateMapBuilder(MapFactoryIfc<K,V> 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.

AbstractJPlateMapBuilder

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

Method Detail

getResult

public java.util.Map<K,V> getResult()
Return the built object.

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

reset

public void reset()
Reset any result currently held.

Specified by:
reset in interface BuilderIfc<java.util.Map<K,V>>

buildStart

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

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

getActualResultMap

protected java.util.Map<K,V> getActualResultMap()
This method returns the actual result and is available to subclasses.

Returns:
The actual result.