org.eclipse.xtext.naming
Class QualifiedName

java.lang.Object
  extended by org.eclipse.xtext.naming.QualifiedName
All Implemented Interfaces:
java.lang.Comparable<QualifiedName>

public class QualifiedName
extends java.lang.Object
implements java.lang.Comparable<QualifiedName>

A datatype for dealing with qualified names. Instances are usually provided by a IQualifiedNameProvider.

Author:
Jan Koehnlein - Initial contribution and API, Sebastian Zarnekow

Field Summary
static QualifiedName EMPTY
           
 
Constructor Summary
protected QualifiedName(java.lang.String... segments)
           
 
Method Summary
 QualifiedName append(QualifiedName relativeQualifiedName)
           
 QualifiedName append(java.lang.String segment)
           
 int compareTo(QualifiedName qualifiedName)
           
protected  int compareTo(QualifiedName qualifiedName, boolean ignoreCase)
           
 int compareToIgnoreCase(QualifiedName qualifiedName)
           
static QualifiedName create(java.lang.String... segments)
          Low-level factory method.
 boolean equals(java.lang.Object obj)
           
 boolean equalsIgnoreCase(java.lang.Object obj)
           
 java.lang.String getFirstSegment()
           
 java.lang.String getLastSegment()
           
 java.lang.String getSegment(int index)
           
 int getSegmentCount()
           
 java.util.List<java.lang.String> getSegments()
           
 int hashCode()
           
 boolean isEmpty()
           
 QualifiedName skipFirst(int skipCount)
           
 QualifiedName skipLast(int skipCount)
           
 boolean startsWith(QualifiedName prefix)
           
protected  boolean startsWith(QualifiedName prefix, boolean ignoreCase)
           
 boolean startsWithIgnoreCase(QualifiedName prefix)
           
 QualifiedName toLowerCase()
           
 java.lang.String toString()
          Returns a canonical String representation of this using '.' as namespace delimiter.
 QualifiedName toUpperCase()
           
static
<F> com.google.common.base.Function<F,QualifiedName>
wrapper(com.google.common.base.Function<F,java.lang.String> nameFunction)
          Wrapps a name function to return a qualified name.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY

public static final QualifiedName EMPTY
Constructor Detail

QualifiedName

protected QualifiedName(java.lang.String... segments)
Method Detail

create

public static QualifiedName create(java.lang.String... segments)
Low-level factory method. Consider using a IQualifiedNameConverter instead.

Throws:
java.lang.IllegalArgumentException - if any of the segments is null

wrapper

public static <F> com.google.common.base.Function<F,QualifiedName> wrapper(com.google.common.base.Function<F,java.lang.String> nameFunction)
Wrapps a name function to return a qualified name. Returns null if the name function returns null.


isEmpty

public boolean isEmpty()

getSegments

public java.util.List<java.lang.String> getSegments()

getSegmentCount

public int getSegmentCount()

getSegment

public java.lang.String getSegment(int index)

getLastSegment

public java.lang.String getLastSegment()

getFirstSegment

public java.lang.String getFirstSegment()

append

public QualifiedName append(java.lang.String segment)

append

public QualifiedName append(QualifiedName relativeQualifiedName)

skipFirst

public QualifiedName skipFirst(int skipCount)

skipLast

public QualifiedName skipLast(int skipCount)

toLowerCase

public QualifiedName toLowerCase()

toUpperCase

public QualifiedName toUpperCase()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

equalsIgnoreCase

public boolean equalsIgnoreCase(java.lang.Object obj)

compareTo

public int compareTo(QualifiedName qualifiedName)
Specified by:
compareTo in interface java.lang.Comparable<QualifiedName>

compareToIgnoreCase

public int compareToIgnoreCase(QualifiedName qualifiedName)

compareTo

protected int compareTo(QualifiedName qualifiedName,
                        boolean ignoreCase)

startsWith

public boolean startsWith(QualifiedName prefix)

startsWithIgnoreCase

public boolean startsWithIgnoreCase(QualifiedName prefix)

startsWith

protected boolean startsWith(QualifiedName prefix,
                             boolean ignoreCase)

toString

public java.lang.String toString()
Returns a canonical String representation of this using '.' as namespace delimiter. For language specific conversion taking the concrete syntax into account see IQualifiedNameConverter.toString(QualifiedName).

Overrides:
toString in class java.lang.Object