org.apache.jdo.impl.jdoql.scope
Class TypeNames

java.lang.Object
  extended by org.apache.jdo.impl.jdoql.scope.TypeNames

public class TypeNames
extends java.lang.Object

The table handling type names.

TBD:

Author:
Michael Bouschen

Field Summary
protected  java.lang.String currentPackage
          The package of the class of the current compilation unit.
protected  java.util.Set importOnDemands
          Collection of type-imports-on-demand.
protected  java.util.Map imports
          Map of single-type-imports.
protected  TypeSupport typeSupport
          The corresponding type table.
 
Constructor Summary
TypeNames(TypeSupport typeSupport)
          Creates a new TypeNames instance.
 
Method Summary
 java.lang.String declareImport(java.lang.String typeName)
          Defines a single-type-import.
 void declareImportOnDemand(java.lang.String packageName)
          Defines a type-import-on-demand.
 void init(java.lang.String compilationUnit)
          This method initializes the TypeNames table.
 org.apache.jdo.model.java.JavaType resolve(java.lang.String name)
          Resolves a type name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

typeSupport

protected TypeSupport typeSupport
The corresponding type table.


imports

protected java.util.Map imports
Map of single-type-imports. Key is the imported class name, value is the fully qualified class name.


importOnDemands

protected java.util.Set importOnDemands
Collection of type-imports-on-demand. The collection stores the imported package names.


currentPackage

protected java.lang.String currentPackage
The package of the class of the current compilation unit.

Constructor Detail

TypeNames

public TypeNames(TypeSupport typeSupport)
Creates a new TypeNames instance.

Method Detail

init

public void init(java.lang.String compilationUnit)
This method initializes the TypeNames table. It sets the currentPackage as the package name of the specified compilation unit. It also adds the package java.lang to the type-imports-on-demand.


declareImport

public java.lang.String declareImport(java.lang.String typeName)
Defines a single-type-import.

Parameters:
typeName - the fully qualified name of the type to be imported.

declareImportOnDemand

public void declareImportOnDemand(java.lang.String packageName)
Defines a type-import-on-demand.

Parameters:
packageName - the package name to be imported.

resolve

public org.apache.jdo.model.java.JavaType resolve(java.lang.String name)
Resolves a type name. If the specified type name is fully qualified the method checks the type table for the type representation. If the name is not fully qualified, the method first checks whether there is a single-type-import importing the specified name. If not it checks whether the current package defines this type. If not the method checks whether there is a single type-import-on-demand for the spceified name.

Parameters:
name - a type name
Returns:
the type representation for the type name.


Copyright © 2005-2011 Apache Software Foundation. All Rights Reserved.