Class QualifiedNameFactory


  • public final class QualifiedNameFactory
    extends java.lang.Object
    Static factory methods for JavaQualifiedName.
    Since:
    6.1.0
    Author:
    Clément Fournier
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static JavaTypeQualifiedName ofClass​(java.lang.Class<?> clazz)
      Gets the qualified name of a class.
      static JavaQualifiedName ofString​(java.lang.String name)
      Parses a qualified name given in the format defined for this implementation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • ofClass

        public static JavaTypeQualifiedName ofClass​(java.lang.Class<?> clazz)
        Gets the qualified name of a class.
        Parameters:
        clazz - Class object
        Returns:
        The qualified name of the class, or null if the class is null
      • ofString

        public static JavaQualifiedName ofString​(java.lang.String name)
        Parses a qualified name given in the format defined for this implementation. The format is specified by a regex pattern (see FORMAT). Examples:

        com.company.MyClass$Nested#myMethod(String, int)

        • Packages are separated by full stops;
        • Nested classes are separated by a dollar symbol;
        • The optional method suffix is separated from the class with a hashtag;
        • Method arguments are separated by a comma and a single space.

        MyClass$Nested

        • The qualified name of a class in the unnamed package starts with the class name.

        com.foo.Class$1LocalClass

        • A local class' qualified name is assigned an index which identifies it within the scope of its enclosing class. The index is displayed after the separating dollar symbol.
        Parameters:
        name - The name to parse.
        Returns:
        A qualified name instance corresponding to the parsed string.