org.eclipse.xtext.conversion.impl
Class QualifiedNameValueConverter

java.lang.Object
  extended by org.eclipse.xtext.conversion.impl.AbstractValueConverter<java.lang.String>
      extended by org.eclipse.xtext.conversion.impl.QualifiedNameValueConverter
All Implemented Interfaces:
IValueConverter<java.lang.String>
Direct Known Subclasses:
StaticQualifierValueConverter

public class QualifiedNameValueConverter
extends AbstractValueConverter<java.lang.String>

A value converter for qualified names consisting of segments or wildcard literals separated by namespace delimiters. Delegates to another value converter for the segments, thus enabling individual quoting of segments.

Author:
Jan Koehnlein - Initial contribution and API

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.xtext.conversion.IValueConverter
IValueConverter.RuleSpecific
 
Field Summary
protected  java.lang.String fullWildcardLiteral
           
protected  IValueConverterService valueConverterService
           
 
Fields inherited from interface org.eclipse.xtext.conversion.IValueConverter
NO_OP_CONVERTER
 
Constructor Summary
QualifiedNameValueConverter()
           
 
Method Summary
protected  java.lang.String delegateToString(java.lang.String segment)
           
protected  java.lang.String delegateToValue(ILeafNode leafNode)
           
protected  java.lang.String getDelegateRuleName()
           
protected  java.lang.String getFullWildcardLiteral()
           
protected  java.lang.String getNamespaceDelimiter()
          Deprecated. use getStringNamespaceDelimiter() or getValueNamespaceDelimiter().
protected  java.lang.String getStringNamespaceDelimiter()
          Returns the used delimiter in the concrete syntax.
protected  java.lang.String getValueNamespaceDelimiter()
          Returns the used delimiter in the AST.
protected  java.lang.String getWildcardLiteral()
           
protected  boolean isDelegateRuleCall(org.eclipse.emf.ecore.EObject grammarElement)
           
protected  boolean isWildcardLiteral(org.eclipse.emf.ecore.EObject grammarElement)
           
 java.lang.String toString(java.lang.String value)
          Transforms the given value to a string that is conformant to the expected terminal or data type rule.
 java.lang.String toValue(java.lang.String string, INode node)
          Creates a value from the given input.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

valueConverterService

@Inject
protected IValueConverterService valueConverterService

fullWildcardLiteral

protected java.lang.String fullWildcardLiteral
Constructor Detail

QualifiedNameValueConverter

public QualifiedNameValueConverter()
Method Detail

getNamespaceDelimiter

@Deprecated
protected java.lang.String getNamespaceDelimiter()
Deprecated. use getStringNamespaceDelimiter() or getValueNamespaceDelimiter().


getStringNamespaceDelimiter

protected java.lang.String getStringNamespaceDelimiter()
Returns the used delimiter in the concrete syntax.

Returns:
the delimiter in the concrete syntax.

getValueNamespaceDelimiter

protected java.lang.String getValueNamespaceDelimiter()
Returns the used delimiter in the AST.

Returns:
the delimiter in the AST.

getWildcardLiteral

protected java.lang.String getWildcardLiteral()

getDelegateRuleName

protected java.lang.String getDelegateRuleName()

toString

public java.lang.String toString(java.lang.String 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.

toValue

public java.lang.String 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 or node 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 not hidden.
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.

isDelegateRuleCall

protected boolean isDelegateRuleCall(org.eclipse.emf.ecore.EObject grammarElement)

isWildcardLiteral

protected boolean isWildcardLiteral(org.eclipse.emf.ecore.EObject grammarElement)

getFullWildcardLiteral

protected java.lang.String getFullWildcardLiteral()

delegateToString

protected java.lang.String delegateToString(java.lang.String segment)

delegateToValue

protected java.lang.String delegateToValue(ILeafNode leafNode)