edu.rit.classfile
Class SynthesizedInterfaceDescription
java.lang.Object
edu.rit.classfile.TypeReference
edu.rit.classfile.ArrayOrClassReference
edu.rit.classfile.ClassReference
edu.rit.classfile.ClassDescription
edu.rit.classfile.SynthesizedClassOrInterfaceDescription
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:
-
Create an instance of class SynthesizedInterfaceDescription, specifying the
interface name.
-
Modify the interface's public mode if necessary. See this method:
setPublic()
.
-
Add superinterfaces to the interface as necessary. See this method:
addSuperinterface()
.
-
Add public static fields to the interface as necessary. See this class:
SynthesizedInterfaceFieldDescription
.
-
Add public abstract methods to the interface as necessary. See this class:
SynthesizedInterfaceMethodDescription
.
-
Add a class initializer to the interface as necessary. See this class:
SynthesizedClassInitializerDescription
.
-
Emit the interface's binary classfile into an output stream, e.g. a
FileOutputStream or a ByteArrayOutputStream. See this method:
emit()
.
-
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
.
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.