Package org.eclipse.xtext.naming
Class QualifiedName
- java.lang.Object
-
- 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 aIQualifiedNameProvider.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classQualifiedName.BuilderThe Builder allows to create instances of QualifiedName in a slightly more efficient way by pre-allocating the underlying data for a known length.
-
Field Summary
Fields Modifier and Type Field Description static QualifiedNameEMPTYThe single existing empty QualifiedName.
-
Constructor Summary
Constructors Modifier Constructor Description protectedQualifiedName(java.lang.String... segments)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description QualifiedNameappend(java.lang.String segment)QualifiedNameappend(QualifiedName relativeQualifiedName)intcompareTo(QualifiedName qualifiedName)protected intcompareTo(QualifiedName qualifiedName, boolean ignoreCase)intcompareToIgnoreCase(QualifiedName qualifiedName)static QualifiedNamecreate(java.lang.String singleSegment)Low-level factory method.static QualifiedNamecreate(java.lang.String... segments)Low-level factory method.static QualifiedNamecreate(java.util.List<java.lang.String> segments)Low-level factory method.static QualifiedNamecreateFromStream(org.eclipse.emf.ecore.resource.impl.BinaryResourceImpl.EObjectInputStream eObjectInputStream)Internal low level factory method.booleanequals(java.lang.Object obj)booleanequalsIgnoreCase(java.lang.Object obj)java.lang.StringgetFirstSegment()java.lang.StringgetLastSegment()java.lang.StringgetSegment(int index)intgetSegmentCount()java.util.List<java.lang.String>getSegments()inthashCode()booleanisEmpty()QualifiedNameskipFirst(int skipCount)QualifiedNameskipLast(int skipCount)booleanstartsWith(QualifiedName prefix)protected booleanstartsWith(QualifiedName prefix, boolean ignoreCase)booleanstartsWithIgnoreCase(QualifiedName prefix)QualifiedNametoLowerCase()java.lang.StringtoString()Returns a canonical String representation of this using '.' as namespace delimiter.java.lang.StringtoString(java.lang.String delimiter)Returns a String representation of this usingdelimiteras namespace delimiter.QualifiedNametoUpperCase()static <F> com.google.common.base.Function<F,QualifiedName>wrapper(com.google.common.base.Function<F,java.lang.String> nameFunction)Wraps a name function to return a qualified name.voidwriteToStream(org.eclipse.emf.ecore.resource.impl.BinaryResourceImpl.EObjectOutputStream eObjectOutputStream)Internal low level serialization of QualifiedNames.
-
-
-
Field Detail
-
EMPTY
public static final QualifiedName EMPTY
The single existing empty QualifiedName.
-
-
Method Detail
-
create
public static QualifiedName create(java.lang.String... segments)
Low-level factory method. Consider using aIQualifiedNameConverterinstead.- Parameters:
segments- the segments of the to-be-created qualified name. May benull, but may not containnullentries.- Returns:
- a
QualifiedName. Nevernull. - Throws:
java.lang.IllegalArgumentException- if any of the segments is null
-
createFromStream
public static QualifiedName createFromStream(org.eclipse.emf.ecore.resource.impl.BinaryResourceImpl.EObjectInputStream eObjectInputStream) throws java.io.IOException
Internal low level factory method.- Throws:
java.io.IOException- Since:
- 2.4
- Noreference:
- This method is not intended to be referenced by clients.
-
writeToStream
public void writeToStream(org.eclipse.emf.ecore.resource.impl.BinaryResourceImpl.EObjectOutputStream eObjectOutputStream) throws java.io.IOExceptionInternal low level serialization of QualifiedNames.- Throws:
java.io.IOException- Since:
- 2.4
-
create
public static QualifiedName create(java.util.List<java.lang.String> segments)
Low-level factory method. Consider using aIQualifiedNameConverterinstead.- Parameters:
segments- the segments of the to-be-created qualified name. May benull, but may not containnullentries.- Returns:
- a
QualifiedName. Nevernull. - Throws:
java.lang.IllegalArgumentException- if any of the segments is null- Since:
- 2.3
-
create
public static QualifiedName create(java.lang.String singleSegment)
Low-level factory method. Consider using aIQualifiedNameConverterinstead.- Parameters:
singleSegment- the single segment of the newly created qualified name- Throws:
java.lang.IllegalArgumentException- if the singleSegment is null- Since:
- 2.3
-
wrapper
public static <F> com.google.common.base.Function<F,QualifiedName> wrapper(com.google.common.base.Function<F,java.lang.String> nameFunction)
Wraps 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:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
equalsIgnoreCase
public boolean equalsIgnoreCase(java.lang.Object obj)
-
compareTo
public int compareTo(QualifiedName qualifiedName)
- Specified by:
compareToin interfacejava.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 seeIQualifiedNameConverter.toString(QualifiedName).- Overrides:
toStringin classjava.lang.Object
-
toString
public java.lang.String toString(java.lang.String delimiter)
Returns a String representation of this usingdelimiteras namespace delimiter.- Parameters:
delimiter- the delimiter to use.nullwill be represented as the String "null".- Returns:
- the concatenated segments joined with the given
delimiter - Since:
- 2.3
-
-