KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > core > util > ICodeAttribute


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.core.util;
12
13 /**
14  * Description of a code attribute as described in the JVM specifications.
15  *
16  * This interface may be implemented by clients.
17  *
18  * @since 2.0
19  */

20 public interface ICodeAttribute extends IClassFileAttribute {
21     /**
22      * Answer back the max locals value of the code attribute.
23      *
24      * @return the max locals value of the code attribute
25      */

26     int getMaxLocals();
27
28     /**
29      * Answer back the max stack value of the code attribute.
30      *
31      * @return the max stack value of the code attribute
32      */

33     int getMaxStack();
34
35     /**
36      * Answer back the line number attribute, if it exists, null otherwise.
37      *
38      * @return the line number attribute, if it exists, null otherwise
39      */

40     ILineNumberAttribute getLineNumberAttribute();
41
42     /**
43      * Answer back the local variable attribute, if it exists, null otherwise.
44      *
45      * @return the local variable attribute, if it exists, null otherwise
46      */

47     ILocalVariableAttribute getLocalVariableAttribute();
48
49     /**
50      * Answer back the array of exception entries, if they are present.
51      * An empty array otherwise.
52      *
53      * @return the array of exception entries, if they are present.
54      * An empty array otherwise
55      */

56     IExceptionTableEntry[] getExceptionTable();
57     
58     /**
59      * Answer back the array of bytes, which represents all the opcodes as described
60      * in the JVM specifications.
61      *
62      * @return the array of bytes, which represents all the opcodes as described
63      * in the JVM specifications
64      */

65     byte[] getBytecodes();
66
67     /**
68      * Answer back the length of the bytecode contents.
69      *
70      * @return the length of the bytecode contents
71      */

72     long getCodeLength();
73     
74     /**
75      * Answer back the attribute number of the code attribute.
76      *
77      * @return the attribute number of the code attribute
78      */

79     int getAttributesCount();
80
81     /**
82      * Answer back the collection of all attributes of the field info. It
83      * includes the LineNumberAttribute and the LocalVariableTableAttribute.
84      * Returns an empty collection if none.
85      *
86      * @return the collection of all attributes of the field info. It
87      * includes the LineNumberAttribute and the LocalVariableTableAttribute.
88      * Returns an empty collection if none
89      */

90     IClassFileAttribute[] getAttributes();
91
92     /**
93      * Answer back the exception table length of the code attribute.
94      *
95      * @return the exception table length of the code attribute
96      */

97     int getExceptionTableLength();
98     
99     /**
100      * Define a Java opcodes walker. All actions are defined in the visitor.
101      * @param visitor The visitor to use to walk the opcodes.
102      *
103      * @exception ClassFormatException Exception thrown if the opcodes contain invalid bytes
104      */

105     void traverse(IBytecodeVisitor visitor) throws ClassFormatException;
106 }
107
Popular Tags