- 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 charcharAt(int index)booleanisUnnamed()NOTE: use of the unnamed package is highly discouraged.StringlastSegment()For package "foo.bar" returns "bar".intlength()static Pkgnamed(CharSequence name)Instantiates an instance, decorating the given sequence.StringqualifiedClassName(String simpleClassName)For a package "foo.bar" and a simple name "Baz" returns "foo.bar.Baz".CharSequencesubSequence(int start, int end)StringtoString()-
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:
lengthin interfaceCharSequence
-
charAt
public char charAt(int index)
- Specified by:
charAtin interfaceCharSequence
-
subSequence
public CharSequence subSequence(int start, int end)
- Specified by:
subSequencein 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:
toStringin interfaceCharSequence- Overrides:
toStringin classObject
-
-