public abstract class BC_MIFValueSetter extends 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.
Modifier and Type | Field and Description |
---|---|
private String |
defaultValue |
private String |
errorMessage |
protected Object |
objValue |
protected String |
strValue |
Constructor and Description |
---|
BC_MIFValueSetter(String defa)
The constructor accepts a default value for the ValueSetter.
|
Modifier and Type | Method and Description |
---|---|
String |
getError()
Gets and resets the current error message.
|
String |
getString()
Returns the string value.
|
Object |
getValue()
Gets the object value.
|
boolean |
setString(String value)
Sets the value as a String.
|
void |
setValue(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.
|
protected String strValue
protected Object objValue
private String defaultValue
private String errorMessage
public BC_MIFValueSetter(String defa)
The constructor accepts a default value for the ValueSetter.
defa
- String representation of the default valuepublic final boolean setString(String value)
Sets the value as a String. After a setString call, getValue() can be used to access the converted value.
value
- String representation of the object valuepublic final String getString()
Returns the string value.
public final void setValue(Object value)
Sets the object value, and calculates the String value.
value
- The Object valuepublic final Object getValue()
Gets the object value.
public final String getError()
Gets and resets the current error message.
protected void valueToString()
Converts an object value to string - the default implementation uses toString for non-null values.
Copyright © 2017 BitCtrl Systems GmbH. All rights reserved.