FileDocCategorySizeDatePackage
ClassManager.javaAPI DocJ2ME CLDC 1.12165Wed Feb 05 15:56:04 GMT 2003kdp.classparser

ClassManager

public class ClassManager extends Object

Fields Summary
List
classes
SearchPath
path
public static Map
classMap
Constructors Summary
public ClassManager()


      
        classes = new Vector();
        path = null;
    
public ClassManager(SearchPath path)

        this();
        this.path = path;
    
Methods Summary
public ClassFilefindClass(byte typetag, java.lang.String className)

        ClassFile cf=null;

    synchronized(classes) {
            Iterator iter = classes.iterator();

            while ( iter.hasNext() ) {
                cf = ( ClassFile )iter.next();
                if ( cf.equals( className ) )
                    return cf;
            }
        }

    if (typetag == VMConstants.TYPE_TAG_ARRAY) {
            Log.LOGN(4,  "findclass: Array class " + className );
            cf = new ClassFile(null, className, typetag);
            synchronized(classes) {
                classes.add( cf );
            }
        return cf;
    }
        if ( path != null ) {
            FileReference file;

            Log.LOGN(4,  "findclass: finding " + className );
            if ( ( file = path.resolve( className ) ) != null ) {
                return loadClass(className, file, typetag);
            } 
        }
        return null;
    
public java.util.ListgetAllClasses()

        return Collections.unmodifiableList( classes );
    
private ClassFileloadClass(java.lang.String className, FileReference file, byte typetag)


        Log.LOGN(3, "loadclass: " + file );

        ClassFile cf = new ClassFile(file, className, typetag);

        try { 
            cf.readClassFile();
            synchronized(classes) {
                classes.add( cf );
            }
        }
        catch ( Exception e ) { 
            Log.LOGN(2,  "Error loading: " + file );
            cf = null;
        }

        return cf;