public final class AlphaNumericName extends CacheableDataType implements Comparable<AlphaNumericName>
All constructors for this class are private. Creating instances of
AlphaNumericName
is done via the static methods on the class.
Instances of this class are immutable, making them inherently threadsafe.
This class overrides equals(java.lang.Object)
and hashCode()
so that instances
play nicely with the Collection classes.
This class implements the Comparable
interface to ensure that a
sorted list of names is presented in an intuitive order. In particular, case
is ignored, and numeric suffixes are taken into account. For example:
A1
A2
A3
A11
A12
A20
B1
B5
B12
Modifier and Type | Method and Description |
---|---|
static AlphaNumericName |
ann(String s)
Convenience method that simply delegates to
valueOf(String) . |
int |
compareTo(AlphaNumericName other)
Overridden to (a) ignore case, and (b) take embedded numbers into
account.
|
boolean |
equals(Object o) |
int |
hashCode() |
String |
toString() |
static AlphaNumericName |
valueOf(String s)
Returns an object representing the value of the specified alpha-numeric
name.
|
getRefQ, keyFromBytes
public int compareTo(AlphaNumericName other)
compareTo
in interface Comparable<AlphaNumericName>
other
- the other instance we are comparing topublic boolean equals(Object o)
Note that this comparison ignores case.
public static AlphaNumericName valueOf(String s)
s
- the string representation of the alpha-numeric nameNullPointerException
- if the string is nullIllegalArgumentException
- if the string is blankpublic static AlphaNumericName ann(String s)
valueOf(String)
.
Note that code can be written more concisely by using a static import
of this method; for example, the following two statements are
equivalent:
AlphaNumericName a = AlphaNumericName.valueOf("foo25"); AlphaNumericName a = ann("foo25");
s
- the string representation of the alpha-numeric nameNullPointerException
- if the string is nullIllegalArgumentException
- if the string is blankCopyright © 2015. All Rights Reserved.