Class 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.
    • Field Detail

      • EMPTY

        public static final QualifiedName EMPTY
        The single existing empty QualifiedName.
    • 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.
        Parameters:
        segments - the segments of the to-be-created qualified name. May be null, but may not contain null entries.
        Returns:
        a QualifiedName. Never null.
        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.IOException
        Internal 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 a IQualifiedNameConverter instead.
        Parameters:
        segments - the segments of the to-be-created qualified name. May be null, but may not contain null entries.
        Returns:
        a QualifiedName. Never null.
        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 a IQualifiedNameConverter instead.
        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)
      • 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
      • toString

        public java.lang.String toString​(java.lang.String delimiter)
        Returns a String representation of this using delimiter as namespace delimiter.
        Parameters:
        delimiter - the delimiter to use. null will be represented as the String "null".
        Returns:
        the concatenated segments joined with the given delimiter
        Since:
        2.3