jparse
Class CompiledConstructor

java.lang.Object
  extended byjparse.CompiledConstructor
All Implemented Interfaces:
Constructor, HasExceptions

public final class CompiledConstructor
extends Object
implements Constructor

Information on a Java constructor defined in a Java class file

Author:
Jerry James

Field Summary
private  Constructor theConstructor
          The constructor object wrapped by this CompiledConstructor object
 
Constructor Summary
(package private) CompiledConstructor(Constructor cons)
          Create a new CompiledConstructor object
 
Method Summary
 Constructor bestMatch(Constructor cons)
          Find the best match, given two matching constructors
 Type getDeclaringClass()
          Returns the Type object representing the class or interface that declares the constructor represented by this object.
 Type[] getExceptionTypes()
          Returns an array of Type objects that represent the types of the exceptions declared to be thrown by this constructor.
 int getModifiers()
          Returns the Java language modifiers for the constructor represented by this object, as an integer.
 String getName()
          Return the name of this constructor
 Type[] getParameterTypes()
          Returns an array of Type objects that represent the formal parameter types, in declaration order, of this constructor.
 boolean match(Type[] params, Type caller)
          Determines whether this constructor matches the parameters given by a caller
 String toString()
          Return a string describing this CompiledConstructor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

theConstructor

private final Constructor theConstructor
The constructor object wrapped by this CompiledConstructor object

Constructor Detail

CompiledConstructor

CompiledConstructor(Constructor cons)
Create a new CompiledConstructor object

Parameters:
cons - the Constructor object to wrap
Method Detail

getDeclaringClass

public Type getDeclaringClass()
Returns the Type object representing the class or interface that declares the constructor represented by this object.

Specified by:
getDeclaringClass in interface Constructor
Returns:
the Type of the declaring class

getName

public String getName()
Return the name of this constructor

Returns:
the name of this constructor

getModifiers

public int getModifiers()
Returns the Java language modifiers for the constructor represented by this object, as an integer. The Modifier class should be used to decode the modifiers.

Specified by:
getModifiers in interface Constructor
Returns:
the modifiers for this constructor

getParameterTypes

public Type[] getParameterTypes()
Returns an array of Type objects that represent the formal parameter types, in declaration order, of this constructor. Returns an array of length 0 if the underlying constructor takes no parameters.

Specified by:
getParameterTypes in interface Constructor
Returns:
the parameter types of this constructor

getExceptionTypes

public Type[] getExceptionTypes()
Returns an array of Type objects that represent the types of the exceptions declared to be thrown by this constructor. Returns an array of length 0 if the constructor declares no exceptions in its throws clause.

Specified by:
getExceptionTypes in interface HasExceptions
Returns:
the exceptions declared by this constructor

match

public boolean match(Type[] params,
                     Type caller)
Determines whether this constructor matches the parameters given by a caller

Specified by:
match in interface Constructor
Parameters:
params - the types of the parameters to the constructor
caller - the type of the caller
Returns:
true if this constructor matches, false otherwise

bestMatch

public Constructor bestMatch(Constructor cons)
Find the best match, given two matching constructors

Specified by:
bestMatch in interface Constructor
Parameters:
cons - the other constructor to compare
Returns:
either this or cons, depending on which matches best, or null if neither matches best

toString

public String toString()
Return a string describing this CompiledConstructor

Returns:
a string describing this CompiledConstructor