Interface IValueConverter<Type>

All Known Implementing Classes:
AbstractIDValueConverter, AbstractLexerBasedConverter, AbstractNullSafeConverter, AbstractRichTextValueConverter, AbstractToStringConverter, AbstractValueConverter, DefaultTerminalConverter, EFactoryValueConverter, IDValueConverter, IgnoreCaseIDValueConverter, INTValueConverter, KeywordAlternativeConverter, KeywordBasedValueConverter, QualifiedNameValueConverter, RichTextEndValueConverter, RichTextInBetweenValueConverter, RichTextStartValueConverter, RichTextValueConverter, SingleQuotedStringConverter, StaticQualifierValueConverter, STRINGValueConverter

public interface IValueConverter<Type>

A ValueConverter is used to create a semantic value from an input string or node and vice versa.

Sven Efftinge - Initial contribution and API

Nested Class Summary
static interface IValueConverter.RuleSpecific
          Value converters that rely on information about the actual rule that is converted, may implement this interface.
Field Summary
static IValueConverter<? extends java.lang.Object> NO_OP_CONVERTER
Method Summary
 java.lang.String toString(Type value)
          Transforms the given value to a string that is conformant to the expected terminal or data type rule.
 Type toValue(java.lang.String string, INode node)
          Creates a value from the given input.

Field Detail


static final IValueConverter<? extends java.lang.Object> NO_OP_CONVERTER
Method Detail


Type toValue(java.lang.String string,
             INode node)
             throws ValueConverterException

Creates a value from the given input. The input is conformant to a data type or terminal rule.

The given string or node may be null but not both of them.

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 not hidden.
node - the parsed node including hidden parts.
the new value or null.
ValueConverterException - indicates that the string or node did not fulfil the expected format.


java.lang.String toString(Type value)
                          throws ValueConverterException
Transforms the given value to a string that is conformant to the expected terminal or data type rule.

value - the to-be-transformed value
a string represenation for that value.
ValueConverterException - indicates that the value cannot be converted to a valid string.