Module uk.autores

Class Pkg

java.lang.Object
uk.autores.handling.Pkg
All Implemented Interfaces:
CharSequence

public final class Pkg extends Object implements CharSequence
Character representation of a Java package.
  • Method Details

    • named

      public static Pkg named(CharSequence name)
      Instantiates an instance, decorating the given sequence. The argument is typically a Name.
      Parameters:
      name - package name of the annotated type or package
      Returns:
      instance
    • qualifiedClassName

      public String qualifiedClassName(String simpleClassName)
      For a package "foo.bar" and a simple name "Baz" returns "foo.bar.Baz". For unnamed package and simple name "Foo" returns "Foo".
      Parameters:
      simpleClassName - simple class name without package
      Returns:
      the fully qualified class name
      See Also:
    • isUnnamed

      public boolean isUnnamed()
      NOTE: use of the unnamed package is highly discouraged.
      Returns:
      true if this is the unnamed package
    • length

      public int length()
      Specified by:
      length in interface CharSequence
    • charAt

      public char charAt(int index)
      Specified by:
      charAt in interface CharSequence
    • subSequence

      public CharSequence subSequence(int start, int end)
      Specified by:
      subSequence in interface CharSequence
    • lastSegment

      public String lastSegment()
      For package "foo.bar" returns "bar". For unnamed package returns "".
      Returns:
      the last dotted segment
    • toString

      public String toString()
      Specified by:
      toString in interface CharSequence
      Overrides:
      toString in class Object