Class AbstractNullSafeConverter<T>
- java.lang.Object
-
- org.eclipse.xtext.conversion.impl.AbstractValueConverter<T>
-
- org.eclipse.xtext.conversion.impl.AbstractNullSafeConverter<T>
-
- All Implemented Interfaces:
IValueConverter<T>
- Direct Known Subclasses:
AbstractToStringConverter
public abstract class AbstractNullSafeConverter<T> extends AbstractValueConverter<T>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.xtext.conversion.IValueConverter
IValueConverter.RuleSpecific
-
-
Field Summary
-
Fields inherited from interface org.eclipse.xtext.conversion.IValueConverter
NO_OP_CONVERTER
-
-
Constructor Summary
Constructors Constructor Description AbstractNullSafeConverter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract java.lang.String
internalToString(T value)
protected abstract T
internalToValue(java.lang.String string, INode node)
java.lang.String
toString(T value)
Transforms the given value to a string that is conformant to the expected terminal or data type rule.T
toValue(java.lang.String string, INode node)
Creates a value from the given input.
-
-
-
Method Detail
-
toString
public java.lang.String toString(T value)
Description copied from interface:IValueConverter
Transforms the given value to a string that is conformant to the expected terminal or data type rule.- Parameters:
value
- the to-be-transformed value- Returns:
- a string represenation for that value.
-
internalToString
protected abstract java.lang.String internalToString(T value)
-
toValue
public T toValue(java.lang.String string, INode node) throws ValueConverterException
Description copied from interface:IValueConverter
Creates a value from the given input. The input is conformant to a data type or terminal rule.
The given
string
ornode
may be null but not both of them.- Parameters:
string
- the string that was inferred from the node. Usually the node's text but may be reduced to the parts of the node that are nothidden
.node
- the parsed node including hidden parts.- Returns:
- the new value or
null
. - Throws:
ValueConverterException
- indicates that the string or node did not fulfil the expected format.
-
internalToValue
protected abstract T internalToValue(java.lang.String string, INode node) throws ValueConverterException
- Throws:
ValueConverterException
-
-