org.openide.src
Class Identifier

java.lang.Object
  |
  +--org.openide.src.Identifier
All Implemented Interfaces:
Serializable

public final class Identifier
extends Object
implements Serializable

Represents one identifier.

See Also:
Serialized Form

Inner Class Summary
static interface Identifier.Resolver
          The interface allows lazy resolving of an Identifier to a fully qualified name.
 
Field Summary
static int NOT_YET_RESOLVED
          The identifier was not yet resolved, it was constructed without context information or with unsuitable context.
static int RESOLVED
          The identifier was resolved, the full name is filled in.
static int UNRESOLVED
          The identifier cannot be resolved.
 
Method Summary
 boolean compareTo(Identifier id, boolean source)
          Compare the specified Identifier with this Identifier for equality.
static Identifier create(Identifier.Resolver resolver, String name)
          Create an Identifier
static Identifier create(String name)
          Create an identifier with the same source name and fully qualified name.
static Identifier create(String fullName, String sourceName)
          Create an identifier.
static Identifier create(String full, String sourceName, int status)
           
 boolean equals(Object o)
          Compare the specified object with this Identifier for equality.
 String getFullName()
          Get the qualified name with the package prefix (if any).
 String getName()
          Get the simple name within a package.
 String getQualifier()
          Get the package prefix.
 int getResolutionStatus()
          Returns the resolution status of the identifier.
 String getSourceName()
          Get the identifier for the code generation.
 int hashCode()
           
 boolean isQualified()
          Test whether this identifier is qualified by package.
 String toString()
          This function was changed to match the behaviour of Type.toString that returns text representation suitable for the source file.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NOT_YET_RESOLVED

public static final int NOT_YET_RESOLVED
The identifier was not yet resolved, it was constructed without context information or with unsuitable context.

RESOLVED

public static final int RESOLVED
The identifier was resolved, the full name is filled in.

UNRESOLVED

public static final int UNRESOLVED
The identifier cannot be resolved. Although the full name is == source name, the identifier does not correspond to anything.
Method Detail

create

public static Identifier create(String name)
Create an identifier with the same source name and fully qualified name.
Parameters:
name - the fully qualified name to create the identifier from
Returns:
the identifier

create

public static Identifier create(String fullName,
                                String sourceName)
Create an identifier.
Parameters:
fullName - fully qualified name
sourceName - name for code generation
Returns:
the identifier

create

public static Identifier create(String full,
                                String sourceName,
                                int status)

create

public static Identifier create(Identifier.Resolver resolver,
                                String name)
Create an Identifier
Parameters:
resolver - a Resolver
name - the name of the identifier to create

getName

public String getName()
Get the simple name within a package.
Returns:
the simple name

getSourceName

public String getSourceName()
Get the identifier for the code generation.
Returns:
the name from the source code

getQualifier

public String getQualifier()
Get the package prefix.
Returns:
the prefix, with no trailing dot, or an empty string if in the default package

isQualified

public boolean isQualified()
Test whether this identifier is qualified by package.
Returns:
true if so

getFullName

public String getFullName()
Get the qualified name with the package prefix (if any).
Returns:
the fully qualified name

getResolutionStatus

public int getResolutionStatus()
Returns the resolution status of the identifier. An identifier can be one of the following:

toString

public String toString()
This function was changed to match the behaviour of Type.toString that returns text representation suitable for the source file.
Overrides:
toString in class Object
Returns:
source name of the identifier.

compareTo

public boolean compareTo(Identifier id,
                         boolean source)
Compare the specified Identifier with this Identifier for equality.
Parameters:
id - Identifier to be compared with this
source - Determine if the source name should be also compared. If false only fully qualified name is compared.
Returns:
true if the specified object equals to specified Identifier otherwise false.

equals

public boolean equals(Object o)
Compare the specified object with this Identifier for equality. There are tested only full qualified name.
Overrides:
equals in class Object
Parameters:
o - Object to be compared with this
Returns:
true if the specified object is Identifier with the same fully qualified name, otherwise false.

hashCode

public int hashCode()
Overrides:
hashCode in class Object
Returns:
the hash code of full name String object.


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.