org.geotools.data.mif
Class MIFValueSetter

java.lang.Object
  extended byorg.geotools.data.mif.MIFValueSetter

public abstract class MIFValueSetter
extends java.lang.Object

Utility class for setting object values from strings and vice-versa.

The main use of this class is building a schema-dependent array of "parsers" which speed up the process of reading text lines and converting them into features.

Version:
$Id: MIFValueSetter.java 17700 2006-01-22 23:30:39Z desruisseaux $
Author:
Luca S. Percich, AMA-MI

Field Summary
protected  java.lang.Object objValue
           
protected  java.lang.String strValue
           
 
Constructor Summary
MIFValueSetter(java.lang.String defa)
          The constructor accepts a default value for the ValueSetter.
 
Method Summary
 java.lang.String getError()
          Gets and resets the current error message.
 java.lang.String getString()
          Returns the string value.
 java.lang.Object getValue()
          Gets the object value.
 boolean setString(java.lang.String value)
          Sets the value as a String.
 void setValue(java.lang.Object value)
          Sets the object value, and calculates the String value.
protected abstract  void stringToValue()
          This method must be overridden by descendants in order to implement the correct conversion between strings and object values.
protected  void valueToString()
          Converts an object value to string - the default implementation uses toString for non-null values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

strValue

protected java.lang.String strValue

objValue

protected java.lang.Object objValue
Constructor Detail

MIFValueSetter

public MIFValueSetter(java.lang.String defa)

The constructor accepts a default value for the ValueSetter.

Parameters:
defa - String representation of the default value
Method Detail

setString

public final boolean setString(java.lang.String value)

Sets the value as a String. After a setString call, getValue() can be used to access the converted value.

Parameters:
value - String representation of the object value
Returns:
true if conversion was successful

getString

public final java.lang.String getString()

Returns the string value.

Returns:

setValue

public final void setValue(java.lang.Object value)

Sets the object value, and calculates the String value.

Parameters:
value - The Object value

getValue

public final java.lang.Object getValue()

Gets the object value.

Returns:

getError

public final java.lang.String getError()

Gets and resets the current error message.

Returns:
The current error message, "" if none

valueToString

protected void valueToString()

Converts an object value to string - the default implementation uses toString for non-null values.


stringToValue

protected abstract void stringToValue()
                               throws java.lang.Exception

This method must be overridden by descendants in order to implement the correct conversion between strings and object values.
Must throw an exception if conversion failed

.

Throws:
java.lang.Exception - if value conversion failed


Copyright © GeoTools. All Rights Reserved.