edu.rit.classfile
Class SynthesizedInterfaceDescription

java.lang.Object
  extended by edu.rit.classfile.TypeReference
      extended by edu.rit.classfile.ArrayOrClassReference
          extended by edu.rit.classfile.ClassReference
              extended by edu.rit.classfile.ClassDescription
                  extended by edu.rit.classfile.SynthesizedClassOrInterfaceDescription
                      extended by edu.rit.classfile.SynthesizedInterfaceDescription

public class SynthesizedInterfaceDescription
extends SynthesizedClassOrInterfaceDescription

Class SynthesizedInterfaceDescription is used to synthesize a class description for some actual interface. This lets a program synthesize an interface directly, instead of having to generate Java source and run the Java compiler. To synthesize an interface:

  1. Create an instance of class SynthesizedInterfaceDescription, specifying the interface name.

  2. Modify the interface's public mode if necessary. See this method: setPublic().

  3. Add superinterfaces to the interface as necessary. See this method: addSuperinterface().

  4. Add public static fields to the interface as necessary. See this class: SynthesizedInterfaceFieldDescription.

  5. Add public abstract methods to the interface as necessary. See this class: SynthesizedInterfaceMethodDescription.

  6. Add a class initializer to the interface as necessary. See this class: SynthesizedClassInitializerDescription.

  7. Emit the interface's binary classfile into an output stream, e.g. a FileOutputStream or a ByteArrayOutputStream. See this method: emit().

  8. Load the classfile byte array directly into a classloader; or store the classfile in a place from which a classloader can retrieve it, such as a codebase server URL.

In the documentation below, the term "described interface" means "the interface described by this interface description object."

To synthesize a class description for a class, see class SynthesizedClassDescription.


Constructor Summary
SynthesizedInterfaceDescription(String theInterfaceName)
          Construct a synthesized interface description for an actual interface with the given name.
 
Method Summary
 
Methods inherited from class edu.rit.classfile.SynthesizedClassOrInterfaceDescription
addSuperinterface, emit, setPublic
 
Methods inherited from class edu.rit.classfile.ClassDescription
getFields, getSubroutines, getSuperclass, getSuperinterfaces, isAbstract, isFinal, isInterface, isPublic
 
Methods inherited from class edu.rit.classfile.ClassReference
getClassName, getSimpleName
 
Methods inherited from class edu.rit.classfile.ArrayOrClassReference
getClassInternalName
 
Methods inherited from class edu.rit.classfile.TypeReference
equals, getTypeDescriptor, getWordCount, hashCode, read, toString, write
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SynthesizedInterfaceDescription

public SynthesizedInterfaceDescription(String theInterfaceName)
Construct a synthesized interface description for an actual interface with the given name. Initially, the described interface is a public interface with no superinterfaces, fields, or methods.

Parameters:
theInterfaceName - Described interface's fully-qualified name. The fully qualified interface name uses periods, for example: "com.foo.Bar".
Throws:
NullPointerException - (unchecked exception) Thrown if theInterfaceName is null.
IllegalArgumentException - (unchecked exception) Thrown if theInterfaceName is zero length.


Copyright © 2001-2006 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.