DynamicJava Javadoc: Class ImportationManager

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## koala.dynamicjava.util
Class ImportationManager

    java.lang.Object
      |
      +--koala.dynamicjava.util.ImportationManager

All Implemented Interfaces:
  java.lang.Cloneable

Direct Known Subclasses:
  BufferedImportationManager

public class ImportationManager
extends java.lang.Object
implements java.lang.Cloneable

The instances of this class manages the importation clauses. The `declarePackageImport` method imports a new package. This one has the highest priority over the imported packages when a lookup is made to find a class. The `declareClassImport` method imports a new class. This one has the highest priority over the same suffix imported class.

Field Summary
`protected java.lang.ClassLoader` | `classLoader` The class loader that must be used
`protected java.lang.String` | `currentPackage` This string contains the name of the current package
`protected java.util.List` | `importOnDemandClauses` This list contains the import-on-demand clauses.
`protected java.util.List` | `singleTypeImportClauses` This set contains the single-type-import clauses.

Constructor Summary
`` | `ImportationManager(java.lang.ClassLoader cl)` Creates a new importation manager.
`protected` | `ImportationManager(ImportationManager im)` Copy constructor

Method Summary
`java.lang.Object` | `clone()` Returns a copy of this object
`void` | `declareClassImport(java.lang.String cname)` Declares a new single-type-import clause
`void` | `declarePackageImport(java.lang.String pkg)` Declares a new import-on-demand clause
`protected java.lang.Class` | `findInnerClass(java.lang.String s)` Searches for an inner class from its name in the dotted notation
`java.lang.String` | `getCurrentPackage()` Returns the current package
`java.util.List` | `getImportOnDemandClauses()` Returns the import-on-demand clauses
`protected java.util.List` | `getOuterNames(java.lang.String cname)` Returns a list of the outer classes names
`java.util.List` | `getSingleTypeImportClauses()` Returns the single-type-import clauses
`protected boolean` | `hasSuffix(java.lang.String c1, java.lang.String c2)` Tests whether the fully qualified class name c1 ends with c2
`java.lang.Class` | `lookupClass(java.lang.String cname, java.lang.String ccname)` Loads the class that match to the given name in the source file
`void` | `setClassLoader(java.lang.ClassLoader cl)` Sets the class loader
`void` | `setCurrentPackage(java.lang.String pkg)` Sets the current package.

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### importOnDemandClauses

    protected java.util.List importOnDemandClauses

  This list contains the import-on-demand clauses.

### singleTypeImportClauses

    protected java.util.List singleTypeImportClauses

  This set contains the single-type-import clauses.

### currentPackage

    protected java.lang.String currentPackage

  This string contains the name of the current package

### classLoader

    protected java.lang.ClassLoader classLoader

  The class loader that must be used

Constructor Detail

### ImportationManager

    public ImportationManager(java.lang.ClassLoader cl)

  Creates a new importation manager. The manager is initialized with two predefined import-on-demand clauses: "java.lang" (the java language package) and "" (the anonymous package)
  Parameters:
    `cl` - the class loader to use

### ImportationManager

    protected ImportationManager(ImportationManager im)

  Copy constructor

Method Detail

### clone

    public java.lang.Object clone()

  Returns a copy of this object
  Overrides:
    `clone` in class `java.lang.Object`

### setClassLoader

    public void setClassLoader(java.lang.ClassLoader cl)

  Sets the class loader

### setCurrentPackage

    public void setCurrentPackage(java.lang.String pkg)

  Sets the current package. This has no influence on the behaviour of the `lookupClass` method.
  Parameters:
    `pkg` - the package name

### getCurrentPackage

    public java.lang.String getCurrentPackage()

  Returns the current package

### getImportOnDemandClauses

    public java.util.List getImportOnDemandClauses()

  Returns the import-on-demand clauses

### getSingleTypeImportClauses

    public java.util.List getSingleTypeImportClauses()

  Returns the single-type-import clauses

### declarePackageImport

    public void declarePackageImport(java.lang.String pkg)

  Declares a new import-on-demand clause
  Parameters:
    `pkg` - the package name

### declareClassImport

    public void declareClassImport(java.lang.String cname)
                            throws java.lang.ClassNotFoundException

  Declares a new single-type-import clause
  Parameters:
    `cname` - the fully qualified class name
  Throws:
    `java.lang.ClassNotFoundException` - if the class cannot be found

### lookupClass

    public java.lang.Class lookupClass(java.lang.String cname,
                                       java.lang.String ccname)
                                throws java.lang.ClassNotFoundException

  Loads the class that match to the given name in the source file
  Parameters:
    `cname` - the name of the class to find
    `ccname` - the name of the current class or null
  Returns:
    the class found
  Throws:
    `java.lang.ClassNotFoundException` - if the class cannot be loaded

### getOuterNames

    protected java.util.List getOuterNames(java.lang.String cname)

  Returns a list of the outer classes names

### findInnerClass

    protected java.lang.Class findInnerClass(java.lang.String s)
                                      throws java.lang.ClassNotFoundException

  Searches for an inner class from its name in the dotted notation

### hasSuffix

    protected boolean hasSuffix(java.lang.String c1,
                                java.lang.String c2)

  Tests whether the fully qualified class name c1 ends with c2

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001 Stephane Hillion. All Rights Reserved.