java.lang.Object | |
↳ | sun.tools.java.Identifier |
A class to represent identifiers.
An identifier instance is very similar to a String. The difference is that identifier can't be instanciated directly, instead they are looked up in a hash table. This means that identifiers with the same name map to the same identifier object. This makes comparisons of identifiers much faster.
A lot of identifiers are qualified, that is they have '.'s in them. Each qualified identifier is chopped up into the qualifier and the name. The qualifier is cached in the value field.
Unqualified identifiers can have a type. This type is an integer that can be used by a scanner as a token value. This value has to be set using the setType method.
WARNING: The contents of this source file are not part of any supported API. Code that depends on them does so at its own risk: they are subject to change or removal without notice.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
char | INNERCLASS_PREFIX | A space character, which precedes the first inner class name in a qualified name, and thus marks the qualification as involving inner classes, instead of merely packages. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Add ambigPrefix to `this' to make a new Identifier marked as
ambiguous.
| |||||||||||
Return the class name, without its qualifier,
and with any nesting flattened into a new qualfication structure.
| |||||||||||
Yet another way to slice qualified identifiers:
The head of an identifier is its first qualifier component,
and the tail is the rest of them.
| |||||||||||
Return the unqualified name.
| |||||||||||
Return the qualifier.
| |||||||||||
Determine whether an Identifier has been marked as ambiguous.
| |||||||||||
Check if the name is inner (ie: it contains a ' ').
| |||||||||||
Check if the name is qualified (ie: it contains a '.').
| |||||||||||
Lookup an identifier.
| |||||||||||
Lookup a qualified identifier.
| |||||||||||
Lookup an inner identifier.
| |||||||||||
Remove the ambigPrefix from `this' to get the original identifier.
| |||||||||||
Convert to a string.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
A space character, which precedes the first inner class name in a qualified name, and thus marks the qualification as involving inner classes, instead of merely packages.
Ex: java.util.Vector. Enumerator.
Add ambigPrefix to `this' to make a new Identifier marked as ambiguous. It is important that this new Identifier not refer to an existing class.
Return the class name, without its qualifier, and with any nesting flattened into a new qualfication structure. If the original identifier is inner, the result will be qualified, and can be further decomposed by means of getQualifier and getName.
For example:
Identifier id = Identifier.lookup("pkg.Foo. Bar"); id.getName().name => "Foo. Bar" id.getFlatName().name => "Foo.Bar"
Yet another way to slice qualified identifiers: The head of an identifier is its first qualifier component, and the tail is the rest of them.
Return the unqualified name. In the case of an inner name, the unqualified name will itself contain components.
Return the qualifier. The null identifier is returned if the name was not qualified. The qualifier does not include any inner part of the name.
Determine whether an Identifier has been marked as ambiguous.
Check if the name is inner (ie: it contains a ' ').
Check if the name is qualified (ie: it contains a '.').
Lookup an inner identifier. (Note: n can be idNull.)
Remove the ambigPrefix from `this' to get the original identifier.