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

java.lang.Object
  extended by org.jplate.kvp.parser.impl.defaults.DefaultKvpParseContext
All Implemented Interfaces:
FormattableIfc, PrototypeIfc<DefaultKvpParseContext>, KvpParseContextIfc<DefaultKvpParseContext>

public class DefaultKvpParseContext
extends java.lang.Object
implements KvpParseContextIfc<DefaultKvpParseContext>

Default implementation of KvpParseIfc.

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/DefaultKvpParseContext.java $
    


Field Summary
private  java.lang.String _key
          The parsed key.
private  int _keyColumn
          The column where key was found.
private  int _keyLine
          The line where key was found.
private  org.apache.commons.logging.Log _log
          Used for logging.
private  java.lang.String _value
          The parsed value.
private  int _valueColumn
          The column where value was found.
private  int _valueLine
          The line where value was found.
 
Constructor Summary
DefaultKvpParseContext()
          Default constructor.
DefaultKvpParseContext(DefaultKvpParseContext toCopy)
          This is the copy constructor.
 
Method Summary
 DefaultKvpParseContext createCopy()
          Creates a copy of self.
 DefaultKvpParseContext createInstance()
          Creates a new instance of self (non populated).
 java.lang.String getKey()
          Return the key.
 int getKeyColumn()
          Return the column where key was found.
 int getKeyLine()
          Return the line where key was found.
 java.lang.String getValue()
          Return the value.
 int getValueColumn()
          Return the column where value was found.
 int getValueLine()
          Return the line where value was found.
 void populate(KvpIfc kvp)
          Use the values contained within to populatete kvp.
 void setKey(java.lang.String key, int line, int column)
          This method sets information about the key.
 void setValue(java.lang.String value, int line, int column)
          This method sets information about the value.
 java.lang.String toString()
          
 java.lang.String toString(java.lang.String prepend)
          Returns a string representation of self prepending prepend to each line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_log

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


_key

private java.lang.String _key
The parsed key.


_keyLine

private int _keyLine
The line where key was found.


_keyColumn

private int _keyColumn
The column where key was found.


_value

private java.lang.String _value
The parsed value.


_valueLine

private int _valueLine
The line where value was found.


_valueColumn

private int _valueColumn
The column where value was found.

Constructor Detail

DefaultKvpParseContext

public DefaultKvpParseContext(DefaultKvpParseContext toCopy)
This is the copy constructor.


DefaultKvpParseContext

public DefaultKvpParseContext()
Default constructor.

Method Detail

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(java.lang.String prepend)
Returns a string representation of self prepending prepend to each line.

Specified by:
toString in interface FormattableIfc
Parameters:
prepend - The text to prepend to each line as defined in the return value.
Returns:
A string representation of self who has prepend prepended to each line.

createCopy

public DefaultKvpParseContext createCopy()
Creates a copy of self.

Specified by:
createCopy in interface PrototypeIfc<DefaultKvpParseContext>
Returns:
A new copy of self.

createInstance

public DefaultKvpParseContext createInstance()
Creates a new instance of self (non populated).

Specified by:
createInstance in interface PrototypeIfc<DefaultKvpParseContext>
Returns:
A new instance of self.

getKey

public java.lang.String getKey()
Return the key.

Specified by:
getKey in interface KvpParseContextIfc<DefaultKvpParseContext>
Returns:
The key.

getKeyLine

public int getKeyLine()
Return the line where key was found.

Specified by:
getKeyLine in interface KvpParseContextIfc<DefaultKvpParseContext>
Returns:
The line where key was found.

getKeyColumn

public int getKeyColumn()
Return the column where key was found.

Specified by:
getKeyColumn in interface KvpParseContextIfc<DefaultKvpParseContext>
Returns:
The column where key was found.

setKey

public void setKey(java.lang.String key,
                   int line,
                   int column)
This method sets information about the key.

Specified by:
setKey in interface KvpParseContextIfc<DefaultKvpParseContext>
Parameters:
key - The key encountered.
line - The line where key begins.
column - The column number where key begins.

getValue

public java.lang.String getValue()
Return the value.

Specified by:
getValue in interface KvpParseContextIfc<DefaultKvpParseContext>
Returns:
The value.

getValueLine

public int getValueLine()
Return the line where value was found.

Specified by:
getValueLine in interface KvpParseContextIfc<DefaultKvpParseContext>
Returns:
The line where value was found.

getValueColumn

public int getValueColumn()
Return the column where value was found.

Specified by:
getValueColumn in interface KvpParseContextIfc<DefaultKvpParseContext>
Returns:
The column where value was found.

setValue

public void setValue(java.lang.String value,
                     int line,
                     int column)
This method sets information about the value.

Specified by:
setValue in interface KvpParseContextIfc<DefaultKvpParseContext>
Parameters:
value - The value encountered.
line - The line where value begins.
column - The column number where value begins.

populate

public void populate(KvpIfc kvp)
Use the values contained within to populatete kvp.

Specified by:
populate in interface KvpParseContextIfc<DefaultKvpParseContext>
Parameters:
kvp - The key/value pair to populate.