public final class DotName extends Object implements Comparable<DotName>
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 a 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 | Method and Description |
---|---|
int |
compareTo(DotName other) |
static DotName |
createComponentized(DotName prefix,
String localName)
Constructs a componentized DotName.
|
static DotName |
createSimple(String name)
Constructs a simple DotName which stores the string in it's entirety.
|
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
isComponentized()
Returns whether this DotName is a componentized variant.
|
String |
local()
Returns the local portion of this DotName.
|
DotName |
prefix()
Returns the parent prefix for this DotName or null if there is none.
|
String |
toString()
Returns the regular fully qualifier class name.
|
public static DotName createSimple(String name)
name
- A fully qualified non-null name (with dots)public static DotName createComponentized(DotName prefix, String localName)
prefix
- Another DotName that is the portion to the left of
localName, this may be null if there is not onelocalName
- the local non-null portion of this name, which does not contain
'.'public DotName prefix()
public String local()
public boolean isComponentized()
public String toString()
public int compareTo(DotName other)
compareTo
in interface Comparable<DotName>
Copyright © 2014 JBoss by Red Hat. All rights reserved.