1 18 package org.apache.geronimo.interop.generator; 19 20 import java.lang.reflect.Modifier ; 21 import java.util.Vector ; 22 23 public class JMethod extends JEntity { 24 private JReturnType rt; 25 private JParameter parms[]; 26 private Class thrown[]; 27 private Vector statements; 28 private JBlockStatement bodyBlockStatement; 29 private String body; 31 protected JMethod(String name) { 32 super(name, Modifier.PUBLIC); 33 34 statements = new Vector (); 35 bodyBlockStatement = new JBlockStatement(); 36 } 37 38 protected JMethod(JReturnType rt, String name, JParameter parms[], Class thrown[]) { 39 this(name); 40 41 setRT(rt); 42 setParms(parms); 43 setThrown(thrown); 44 } 45 46 public void setRT(JReturnType jt) { 47 rt = jt; 48 } 49 50 public JReturnType getRT() { 51 return rt; 52 } 53 54 public void setParms(JParameter parms[]) { 55 this.parms = parms; 56 } 57 58 public JParameter[] getParms() { 59 return parms; 60 } 61 62 public void setThrown(Class thrown[]) { 63 this.thrown = thrown; 64 } 65 66 public Class [] getThrown() { 67 return thrown; 68 } 69 70 public void setBody(String body) { 71 this.body = body; 72 } 73 74 public String getBody() { 75 return body; 76 } 77 78 public JLocalVariable newLocalVariable(Class type, String name) { 79 return bodyBlockStatement.newLocalVariable(type, name); 80 } 81 82 public JLocalVariable newLocalVariable(Class type, String name, JExpression initExpr) { 83 return bodyBlockStatement.newLocalVariable(type, name, initExpr); 84 } 85 86 public void deleteLocalVariable(JLocalVariable f) { 87 bodyBlockStatement.deleteLocalVariable(f); 88 } 89 90 public Vector getLocalVariables() { 91 return bodyBlockStatement.getLocalVariables(); 92 } 93 94 public void addStatement(JStatement s) { 95 statements.add(s); 96 } 97 98 public Vector getStatements() { 99 return statements; 100 } 101 } 102 | Popular Tags |