|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--condor.classad.AttrName
An attribute name. It behaves like a String except for its equals and hashCode methods, which ignore case. In simple cases, the string is an identifier (a sequence of letters and digits starting with a letter), but in fact, it may contain arbitrary ASCII characters. If it is not a simple identifier, it is displayed surrounded by single quotes (apostrophes) with backslash escapes for unprintable characters and quotes.
The implementation stores the string in two or three forms, the "raw" form, which is the actual sequence of characters, the "canon" form, which is the raw form translated to lower case, and the "pname" form which is the raw form escaped and quoted if necessary to fit the native syntax for an "Identifier". The pname is generated on demand in toString() and cached.
In any one execution, there is only one instance with a given "raw" string.
The contructor is private, and instances are created by the factory
methods fromString(String)
, which accepts the "raw" form
of the string, and fromText(String)
, which accepts a version
with optional quotes and backslash escapes. For example,
fromString("foo")
and fromText("foo")
return the
same instance of AttrName, as do fromString("one two\nthree")
and fromText("'one two\\012three'")
.
The raw and canon strings are "interned" to save space and to speed up
comparisons: The equals(Object)
method simply compares canon
strings for pointer equality.
AttrRef
Method Summary | |
boolean |
equals(Object o)
Compare this AttrName to another AttrName. |
static AttrName |
fromString(String v)
Returns the instance corresponding to a given raw String. |
static AttrName |
fromText(String v)
Returns the instance corresponding to a given NATIVE representation. |
int |
hashCode()
Compute a hash code for this string. |
String |
rawString()
Returns the original string without quotes or escapes and original capitalization. |
String |
toString()
Converts to a printable String. |
Methods inherited from class Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
public String toString()
toString
in class Object
public String rawString()
public boolean equals(Object o)
equals
in class Object
o
- the other AttrName
ClassCastException
- if o is not an instance of AttrName.
NullPointerException
- if o is null.public int hashCode()
hashCode
in class Object
public static AttrName fromText(String v)
v
- the NATIVE representation.
IllegalArgumentException
- if v is not syntactically valid.public static AttrName fromString(String v)
v
- the original (mixed case) string.
IllegalArgumentException
- if v is not syntactically valid.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |