KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > speedo > metadata > CodeMethod


1 /**
2  * Speedo: an implementation of JDO compliant personality on top of JORM generic
3  * I/O sub-system.
4  * Copyright (C) 2001-2004 France Telecom R&D
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  *
21  *
22  * Contact: speedo@objectweb.org
23  *
24  * Authors: S.Chassande-Barrioz.
25  *
26  */

27
28 package org.objectweb.speedo.metadata;
29
30 import org.objectweb.asm.Constants;
31
32 /**
33  * Stores info on methods of a <code>SpeedoClass</code>
34  * @author S.Chassande-Barrioz
35  */

36 public class CodeMethod {
37
38     /**
39      * Name of the method.If the method is a constructor the name of the method
40      * is null.
41      */

42     public String JavaDoc name;
43
44     /**
45      * is the modifiers of the method
46      * 'public final'
47      */

48     public String JavaDoc modifiers;
49
50     /**
51      * The declaraction of the method parameters.
52      * 'String arg1, int arg2'
53      */

54     public String JavaDoc params;
55
56     /**
57      * The list of the exception thrown by the method
58      */

59     public String JavaDoc[] exceptions;
60
61     /**
62      * Indicates whether this method is a constructor
63      */

64     public boolean isConstructor;
65
66     /**
67      * Call to the super constructor
68      */

69     public String JavaDoc superClass;
70
71     /**
72      * Descriptor of the method (encoded form of its signature and return type)
73      */

74     public String JavaDoc methodDesc;
75
76
77     /**
78      * @param name is the ASM name of the
79      * @param params is the declaraction of method parameters separated by
80      * commas
81      * @param superclass is a string representing the call to the super method.
82      * @param isConstr indicates if the method is a constructor.
83      * @param modifiers is the ASM code representing the method modifiers
84      * @param exceptions is the list of exceptions thrown by the method
85      */

86     public CodeMethod(String JavaDoc name,
87                       String JavaDoc params,
88                       String JavaDoc superclass,
89                       boolean isConstr,
90                       int modifiers,
91                       String JavaDoc[] exceptions) {
92         if ((modifiers & Constants.ACC_PUBLIC) != 0)
93             this.modifiers = "public";
94         else if ((modifiers & Constants.ACC_PRIVATE) != 0)
95             this.modifiers = "protected";
96         else if ((modifiers & Constants.ACC_PROTECTED) != 0)
97             this.modifiers = "protected";
98
99         if ((modifiers & Constants.ACC_FINAL) != 0)
100             this.modifiers += " final";
101         if ((modifiers & Constants.ACC_STATIC) != 0)
102             this.modifiers += " static";
103         if ((modifiers & Constants.ACC_ABSTRACT) != 0)
104             this.modifiers += " abstract";
105
106         this.isConstructor = isConstr;
107         this.name = (isConstructor ? null : name);
108         this.params = params;
109         this.superClass = superclass;
110         this.exceptions = exceptions;
111     }
112 }
113
Popular Tags