edu.rice.cs.javalanglevels
Class MethodData

java.lang.Object
  extended by edu.rice.cs.javalanglevels.Data
      extended by edu.rice.cs.javalanglevels.BodyData
          extended by edu.rice.cs.javalanglevels.MethodData

public class MethodData
extends BodyData

Represents the data for a given method.


Nested Class Summary
static class MethodData.MethodDataTest
          Tests the methods declared above
 
Nested classes/interfaces inherited from class edu.rice.cs.javalanglevels.BodyData
BodyData.BodyDataTest
 
Nested classes/interfaces inherited from class edu.rice.cs.javalanglevels.Data
Data.DataTest
 
Field Summary
 
Fields inherited from class edu.rice.cs.javalanglevels.Data
_blockIterator, _blocks, _enclosingData, _innerClasses, _modifiersAndVisibility, _name, _outerData, _vars
 
Constructor Summary
MethodData(String name, ModifiersAndVisibility modifiersAndVisibility, TypeParameter[] typeParameters, SymbolData returnType, VariableData[] params, String[] thrown, SymbolData enclosingClass, JExpression jexpr)
          Constructor for MethodData.
MethodData(String name, VariableData[] params)
          Constructor used by the LanguageLevelConverter, where only the name and params matter
 
Method Summary
 void addPublicMav()
          Makes this method public.
 boolean equals(Object obj)
          Two MethodDatas are equal if ...
 JExpression getJExpression()
           
 ModifiersAndVisibility getMav()
           
 MethodData getMethodData()
          Will return this, if it is a method data, or the enclosing method data if this is a block data.
 VariableData[] getParams()
           
 SymbolData getReturnType()
           
 String[] getThrown()
           
 TypeParameter[] getTypeParameters()
           
 int hashCode()
          Define a hashCode() method that hashes on the method name and its enclosing data.
 boolean isGenerated()
           
 boolean isMethodData()
          True if this is a method data.
 boolean isStatic()
          Returns true if this MethodData is static.
static MethodData make(String name, ModifiersAndVisibility modifiersAndVisibility, TypeParameter[] typeParameters, SymbolData returnType, VariableData[] params, String[] thrown, SymbolData enclosingClass, JExpression jexpr)
          Factory methods used for debugging purposes among other things.
static MethodData make(String name, VariableData[] params)
           
 void setGenerated(boolean generated)
           
 void setParams(VariableData[] p)
          Set the method params to be p
 void setReturnType(SymbolData rt)
          set the return type to be rt
 void setThrown(String[] thrown)
          Sets thrown to be thrown
 String toBigString()
           
 String toString()
           
 
Methods inherited from class edu.rice.cs.javalanglevels.BodyData
getSymbolData
 
Methods inherited from class edu.rice.cs.javalanglevels.Data
addBlock, addEnclosingData, addFinalVars, addInnerClass, addModifier, addVar, addVars, createUniqueName, dollarSignsToDots, dotsToDollarSigns, getEnclosingClass, getEnclosingData, getInnerClasses, getInnerClassOrInterface, getInnerClassOrInterfaceHelper, getName, getNextAnonymousInnerClass, getNextBlock, getOuterData, getVar, getVars, hasModifier, innerClassesAndInterfacesIterator, isAnonymousClass, isDoublyAnonymous, isOuterData, removeAllBlocks, resetBlockIterator, setEnclosingData, setInnerClasses, setMav, setOuterData
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MethodData

public MethodData(String name,
                  ModifiersAndVisibility modifiersAndVisibility,
                  TypeParameter[] typeParameters,
                  SymbolData returnType,
                  VariableData[] params,
                  String[] thrown,
                  SymbolData enclosingClass,
                  JExpression jexpr)
Constructor for MethodData.

Parameters:
name - The String name of the method
modifiersAndVisibility - The modifiers of the method
typeParameters - The generic type parameters of the method. Not used.
returnType - The SymbolData corresponding to the return type of the method
params - The VariableData[] corresponding to the method parameters
thrown - The Strings corresponding to the exceptions the method is declared to throw
enclosingClass - The SymbolData that contains this method
jexpr - The JExpression corresponding to this method.

MethodData

public MethodData(String name,
                  VariableData[] params)
Constructor used by the LanguageLevelConverter, where only the name and params matter

Method Detail

make

public static MethodData make(String name,
                              ModifiersAndVisibility modifiersAndVisibility,
                              TypeParameter[] typeParameters,
                              SymbolData returnType,
                              VariableData[] params,
                              String[] thrown,
                              SymbolData enclosingClass,
                              JExpression jexpr)
Factory methods used for debugging purposes among other things.


make

public static MethodData make(String name,
                              VariableData[] params)

isGenerated

public boolean isGenerated()
Returns:
true if this method was generated during the LanguageLevel conversion process

isStatic

public boolean isStatic()
Returns true if this MethodData is static.


setGenerated

public void setGenerated(boolean generated)
Parameters:
generated - true or false--whether to set this method to generated or not

equals

public boolean equals(Object obj)
Two MethodDatas are equal if ...

Overrides:
equals in class Object

hashCode

public int hashCode()
Define a hashCode() method that hashes on the method name and its enclosing data.

Overrides:
hashCode in class Object

isMethodData

public boolean isMethodData()
Description copied from class: BodyData
True if this is a method data.

Specified by:
isMethodData in class BodyData

getMethodData

public MethodData getMethodData()
Description copied from class: BodyData
Will return this, if it is a method data, or the enclosing method data if this is a block data.

Specified by:
getMethodData in class BodyData

getTypeParameters

public TypeParameter[] getTypeParameters()
Returns:
the type parameters

getReturnType

public SymbolData getReturnType()
Returns:
the return type

setReturnType

public void setReturnType(SymbolData rt)
set the return type to be rt


getParams

public VariableData[] getParams()
Returns:
the method params

setParams

public void setParams(VariableData[] p)
Set the method params to be p


getThrown

public String[] getThrown()
Returns:
the thrown array for this method

setThrown

public void setThrown(String[] thrown)
Sets thrown to be thrown


getMav

public ModifiersAndVisibility getMav()
Overrides:
getMav in class Data
Returns:
the modifiers and visibility

addPublicMav

public void addPublicMav()
Makes this method public. Only used in ClassBodyElementaryVisitor.


getJExpression

public JExpression getJExpression()
Returns:
the JExpression corresponding to this method

toString

public String toString()
Overrides:
toString in class Object

toBigString

public String toBigString()