- 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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description char
charAt(int index)
boolean
isUnnamed()
NOTE: use of the unnamed package is highly discouraged.String
lastSegment()
For package "foo.bar" returns "bar".int
length()
static Pkg
named(CharSequence name)
Instantiates an instance, decorating the given sequence.String
qualifiedClassName(String simpleClassName)
For a package "foo.bar" and a simple name "Baz" returns "foo.bar.Baz".CharSequence
subSequence(int start, int end)
String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.CharSequence
chars, codePoints
-
-
-
-
Method Detail
-
named
public static Pkg named(CharSequence name)
Instantiates an instance, decorating the given sequence. The argument is typically aName
.- 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:
Class.getSimpleName()
-
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 interfaceCharSequence
-
charAt
public char charAt(int index)
- Specified by:
charAt
in interfaceCharSequence
-
subSequence
public CharSequence subSequence(int start, int end)
- Specified by:
subSequence
in interfaceCharSequence
-
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 interfaceCharSequence
- Overrides:
toString
in classObject
-
-