|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rit.classfile.SubroutineReference
edu.rit.classfile.MethodReference
public class MethodReference
Class MethodReference is used to create a reference to a method. To create a method reference:
Or:
Or:
Do not use the method reference for anything until you have completed the above steps. Once you have completed the above steps and have begun using the method reference, do not alter the method reference's return type or add further argument types or alter the method descriptor.
In the documentation below, the term "referenced method" means "the method referred to by this method reference object."
Constructor Summary | |
---|---|
MethodReference(ClassReference theClassReference,
String theMethodName)
Construct a new method reference object with the given method name. |
|
MethodReference(ClassReference theClassReference,
String theMethodName,
String theMethodDescriptor)
Construct a new method reference object with the given method name and method descriptor. |
Method Summary | |
---|---|
void |
addArgumentType(TypeReference theArgumentType)
Add an argument to the referenced method. |
void |
setMethodDescriptor(String theMethodDescriptor)
Specify the referenced method's method descriptor. |
void |
setReturnType(TypeReference theReturnType)
Specify the referenced method's return type. |
Methods inherited from class edu.rit.classfile.SubroutineReference |
---|
equals, getArgumentTypes, getArgumentWordCount, getClassReference, getMethodDescriptor, getMethodName, getReturnType, hashCode, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MethodReference(ClassReference theClassReference, String theMethodName)
theClassReference
- Class containing this method.theMethodName
- Method name.
NullPointerException
- (unchecked exception) Thrown if theClassReference is null or
theMethodName is null.
IllegalArgumentException
- (unchecked exception) Thrown if theMethodName is zero
length.public MethodReference(ClassReference theClassReference, String theMethodName, String theMethodDescriptor)
theClassReference
- Class containing this method.theMethodName
- Method name.theMethodDescriptor
- Method descriptor in the format specified by Section 4.3.3 of the
Java Virtual Machine Specification, Second Edition.
NullPointerException
- (unchecked exception) Thrown if theClassReference is null or
theMethodName is null or theMethodDescriptor is
null.
IllegalArgumentException
- (unchecked exception) Thrown if theMethodName is zero
length. Thrown if theMethodDescriptor does not obey the
syntax of a method descriptor. Thrown if the number of arguments in
theMethodDescriptor exceeds the limit (254).Method Detail |
---|
public void setReturnType(TypeReference theReturnType)
theReturnType
- Type reference for the return type, or null if the
referenced method returns void.
IllegalStateException
- (unchecked exception) Thrown if the return type cannot be altered
because this method reference is already in use.public void addArgumentType(TypeReference theArgumentType) throws ListFullException
theArgumentType
- Argument's type reference.
NullPointerException
- (unchecked exception) Thrown if theArgumentType is null.
IllegalStateException
- (unchecked exception) Thrown if further argument types cannot be
added because this method reference is already in use.
ListFullException
- Thrown if adding theArgumentType would cause the referenced
method's argument word count to exceed the limit (254).public void setMethodDescriptor(String theMethodDescriptor)
theMethodDescriptor
- Method descriptor in the format specified by Section 4.3.3 of the
Java Virtual Machine Specification, Second Edition.
NullPointerException
- (unchecked exception) Thrown if theMethodDescriptor is null.
IllegalStateException
- (unchecked exception) Thrown if the method descriptor cannot be
set because this method reference is already in use.
IllegalArgumentException
- (unchecked exception) Thrown if theMethodDescriptor does not
obey the syntax of a method descriptor. Thrown if the number of
arguments in theMethodDescriptor exceeds the limit (254).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |