DotName represents a dot separated name, typically a Java package or a Java class.
It has two possible variants. A simple wrapper based variant allows for fast construction
(it simply wraps the specified name string). Whereas, a componentized variant represents
one or more String components that, when combined with a dot character, assemble the
full name. The intention of the componentized variant is that the String components
can be reused to offer memory efficiency. This reuse is common in Java where packages
and classes follow a tree structure.
Both the simple and componentized variants are considered semantically equivalent if they
refer to the same logical name. More specifically, the equals and hashCode
methods return the same values for the same semantic name regardless of the variant used.
Which variant to use when depends on the specific performance and overhead objectives
of the specific use pattern.
Simple names are cheap to construct (just an additional wrapper object), so are ideal for
temporary use, like looking for an entry in a Map. Componentized names however require
that they be split in advance, and so require some additional time to construct. However, the memory
benefits of reusing component strings make them desirable when stored in a longer term area
such as in a Java data structure.
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| public static final DotName | |
| private int | |
| private final boolean | |
| pack-priv static final DotName | |
| pack-priv static final DotName | |
| pack-priv static final DotName | |
| private final String | |
| public static final DotName | |
| private final DotName | |
| public static final DotName | |
| public static final DotName |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public int | Returns: a negative number if this is less than the specified object, a positive if greater, and zero if equalthe other)DotName to compare toImplements java. DotName to another DotName and returns whether this DotName
is lesser than, greater than, or equal to the specified DotName.
|
| private static int | |
| private static boolean | |
| public static DotName | Returns: a componentizedDotName; never nullanother prefix, String DotName that is the portion of the final name to the left of localName; may be
null if there is no prefixthe local portion of this name; must not be localName)null and must not contain '.'Constructs a componentized |
| public static DotName | Returns: a componentizedDotName; never nullanother prefix, String DotName that is the portion of the final name to the left of localName; may be
null if there is no prefixthe local portion of this name; must not be localName, boolean null and must not contain '.'whether the innerClass)localName is an inner class style name, which is joined to the prefix using
'$' instead of '.'Constructs a componentized |
| public static DotName | Returns: a simpleDotName that wraps given name; never nulla fully qualified name (with dots); must not be name)nullConstructs a simple |
| public static DotName | Returns: a simpleDotName that wraps the name of given clazz; never nulla class whose fully qualified name is returned; must not be clazz)nullConstructs a simple |
| public boolean | Returns: true if equal, false if notthe o)DotName object to compare toOverrides java. DotName to another DotName and returns true
if they represent the same underlying semantic name.
|
| private static DotName[] | |
| public int | Returns: a hash code representing this objectOverrides java. DotName.
|
| public boolean | Returns: true if it is componentized, false if it is a simple DotNameReturns whether this |
| public boolean | |
| public String | |
| public String | |
| public DotName | |
| public DotName | |
| private void | |
| public String | Returns: the binary class nameOverrides java. |
| public String | Returns: the binary class name with given character used as a package separatorthe package separator; typically delim)., but may be e.g. /
to construct a bytecode descriptorReturns the regular binary class name where |
| public String | Returns: the portion of the fully qualified name that does not include a package nameReturns the portion of this |
| componentized | back to summary |
|---|---|
| private final boolean componentized | |
| ENUM_NAME | back to summary |
|---|---|
| public static final DotName ENUM_NAME | |
| hash | back to summary |
|---|---|
| private int hash | |
| innerClass | back to summary |
|---|---|
| private final boolean innerClass | |
| JAVA_LANG_ANNOTATION_NAME | back to summary |
|---|---|
| pack-priv static final DotName JAVA_LANG_ANNOTATION_NAME | |
| JAVA_LANG_NAME | back to summary |
|---|---|
| pack-priv static final DotName JAVA_LANG_NAME | |
| JAVA_NAME | back to summary |
|---|---|
| pack-priv static final DotName JAVA_NAME | |
| local | back to summary |
|---|---|
| private final String local | |
| OBJECT_NAME | back to summary |
|---|---|
| public static final DotName OBJECT_NAME | |
| prefix | back to summary |
|---|---|
| private final DotName prefix | |
| RECORD_NAME | back to summary |
|---|---|
| public static final DotName RECORD_NAME | |
| STRING_NAME | back to summary |
|---|---|
| public static final DotName STRING_NAME | |
| DotName | back to summary |
|---|---|
| pack-priv DotName(DotName prefix, String local, boolean noDots, boolean innerClass) | |
| buildString | back to summary |
|---|---|
| private void buildString(char delim, StringBuilder builder) | |
| compareTo | back to summary |
|---|---|
| public int compareTo(DotName other) Implements java. Compares a
| |
| componentizedCompare | back to summary |
|---|---|
| private static int componentizedCompare(DotName[] a, DotName[] b) | |
| componentizedEquals | back to summary |
|---|---|
| private static boolean componentizedEquals(DotName a, DotName b) | |
| createComponentized | back to summary |
|---|---|
| public static DotName createComponentized(DotName prefix, String localName) Constructs a componentized | |
| createComponentized | back to summary |
|---|---|
| public static DotName createComponentized(DotName prefix, String localName, boolean innerClass) Constructs a componentized
| |
| createSimple | back to summary |
|---|---|
| public static DotName createSimple(String name) Constructs a simple | |
| createSimple | back to summary |
|---|---|
| public static DotName createSimple(Class<?> clazz) Constructs a simple
This method is a shortcut for | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Compares a
| |
| flatten | back to summary |
|---|---|
| private static DotName[] flatten(DotName name) | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Returns a hash code which is based on the semantic representation of this
Whether a
| |
| isComponentized | back to summary |
|---|---|
| public boolean isComponentized() Returns whether this
| |
| isInner | back to summary |
|---|---|
| public boolean isInner() Returns whether the local portion of a componentized
This should not be used to test whether the name truly refers to an inner class,
only that the dollar sign delimits the value. Java class names are allowed to contain
index.getClassByName(name).nestingType() != TOP_LEVEL;
| |
| local | back to summary |
|---|---|
| public String local() Returns the local portion of this
Use
| |
| packagePrefix | back to summary |
|---|---|
| public String packagePrefix() Returns the package portion of this | |
| packagePrefixName | back to summary |
|---|---|
| public DotName packagePrefixName() Returns the package portion of this | |
| prefix | back to summary |
|---|---|
| public DotName prefix() Returns the parent prefix for this
| |
| stripPackage | back to summary |
|---|---|
| private void stripPackage(StringBuilder builder) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns the regular binary class name.
| |
| toString | back to summary |
|---|---|
| public String toString(char delim) Returns the regular binary class name where
| |
| withoutPackagePrefix | back to summary |
|---|---|
| public String withoutPackagePrefix() Returns the portion of this
| |