jakarta-bcel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Dixon-Peugh <dixonpe...@yahoo.com>
Subject Re: Dealing with Repository class.
Date Wed, 17 Apr 2002 14:15:18 GMT

--- Dale E Martin <dmartin@cliftonlabs.com> wrote:
> 
> What I would prefer to see in BCEL in a lot of these
> areas are interfaces
> that have several realizations.  I'd like to see a
> "BCELClass" interface, a
> "Repository" interface, an "Attribute" interface, a
> "ConstantPool"
> interface, etc.  Then I'd like to see the various
> forms of these things
> (read in from class, synthetically generated, etc)
> be different
> instantiations of these interfaces.  And in general,
> I would design things
> so that references generally only refer to these
> interfaces, never to
> concrete implementations.  (Instantiation obviously
> has to happen on the
> concrete classes.)  
> 

I do like the idea of moving towards interfaces, it
would make testing a lot easier.

How about this for a Repository interface:

- - - - - -

public interface Repository {
  /** 
   * Store the provided class under "getClassName()"
   */
  public void storeClass( JavaClass clazz );

  /**
   * Find a class which has already been loaded.
   * Returns NULL if class hasn't been loaded yet.
   */
  public JavaClass findClass( String className );

  /**
   * If the class isn't stored in the repository,
   * it loads it.  If it is, then it returns the
   * existing copy.
   */
  public JavaClass loadClass( String className )
     throws java.lang.ClassNotFoundException;
}

- - - - - -

I'm sure we would need the "loadClass" method, I'm
not so sure about the "findClass" however.

The storeClass method would be needed for creating
new classes, rather than modifing existing classes.

This interface also suggests a new structure for
the ClassLoader.  (Pass a custom Repository into
the ClassLoader, and then the ClassLoader is 
complete.)


> 
> Take care,
>      Dale

DDP

> -- 
> Dale E. Martin, Clifton Labs, Inc.
> Senior Computer Engineer
> dmartin@cliftonlabs.com
> http://www.cliftonlabs.com
> pgp key available
> 
> --
> To unsubscribe, e-mail:  
> <mailto:bcel-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:bcel-dev-help@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

--
To unsubscribe, e-mail:   <mailto:bcel-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:bcel-dev-help@jakarta.apache.org>


Mime
View raw message