edu.rit.classfile
Class SynthesizedClassOrInterfaceDescription

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
Direct Known Subclasses:
SynthesizedClassDescription, SynthesizedInterfaceDescription

public abstract class SynthesizedClassOrInterfaceDescription
extends ClassDescription

Class SynthesizedClassOrInterfaceDescription is the abstract superclass for an object used to synthesize a class description for some actual class or interface. This lets a program synthesize a class or interface directly, instead of having to generate Java source and run the Java compiler. In the documentation below, the term "described class" means "the class or interface described by this class description object."


Method Summary
 void addSuperinterface(ClassReference theSuperinterface)
          Add a superinterface to the described class.
 void emit(OutputStream theOutputStream)
          Emit the described class into the given output stream in binary classfile format.
 void setPublic(boolean isPublic)
          Specify whether the described class is public, that is, can be accessed from outside its package.
 
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
 

Method Detail

setPublic

public void setPublic(boolean isPublic)
Specify whether the described class is public, that is, can be accessed from outside its package.

Parameters:
isPublic - True means public, false means non-public.

addSuperinterface

public void addSuperinterface(ClassReference theSuperinterface)
                       throws ListFullException
Add a superinterface to the described class.

Parameters:
theSuperinterface - Interface reference.
Throws:
NullPointerException - (unchecked exception) Thrown if theSuperinterface is null.
ListFullException - Thrown if the described class's superinterface list is full (i.e., contains 65535 superinterfaces).

emit

public void emit(OutputStream theOutputStream)
          throws DuplicateFieldException,
                 DuplicateSubroutineException,
                 ListFullException,
                 ByteCodeException,
                 IOException
Emit the described class into the given output stream in binary classfile format.

Parameters:
theOutputStream - Output stream.
Throws:
NullPointerException - (unchecked exception) Thrown if theOutputStream is null.
DuplicateFieldException - Thrown if the described class contains more than one field with the same name and descriptor. In this case nothing is written to theOutputStream.
DuplicateSubroutineException - Thrown if the described class contains more than one subroutine (method, constructor, or class initializer) with the same name and descriptor. In this case nothing is written to theOutputStream.
ListFullException - Thrown if more than the maximum allowed number of constant pool entries need to be added to the described class's constant pool. In this case nothing is written to theOutputStream.
ByteCodeException - Thrown if there was a problem generating this class's bytecodes. The exception's detail message describes the problem. In this case a portion of the classfile may have been written to theOutputStream.
IOException - Thrown if an I/O error occurred. In this case a portion of the classfile may have been written to theOutputStream.


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