Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/chaoswg/xtc4y/classdesc/MethodInfo.java


1   //$Header: /cvsroot/xtc4y/xtc4y/src/com/chaoswg/xtc4y/classdesc/MethodInfo.java,v 1.2 2003/08/26 12:48:28 toggm Exp $
2   /******************************************************************************
3    * XTC4y - eXtreme Testing Collection 4 you                                   *
4    * -------------------------------------------------------------------------- *
5    * URL: http://www.chaoswg.com/xtc4y                                          *
6    * Author: Mike Toggweiler (2.dog@gmx.ch)                                     *
7    *                                                                            *
8    * Last Updated: $Date: 2003/08/26 12:48:28 $, by $Author: toggm $            *
9    * Version: $Revision: 1.2 $                                                  *
10   * -------------------------------------------------------------------------- *
11   * COPYRIGHT:   (c) 2003 by Mike Toggweiler                                   *
12   *                                                                            *
13   * This program is free software; you can redistribute it and/or modify       *
14   * it under the terms of the GNU General Public License as published by       *
15   * the Free Software Foundation; either version 2 of the License, or          *
16   * (at your option) any later version.                                        *
17   *****************************************************************************/
18  package com.chaoswg.xtc4y.classdesc;
19  
20  import java.util.Vector;
21  
22  import java.io.DataInputStream;
23  import java.io.DataOutputStream;
24  import java.io.IOException;
25  
26  /**
27   * This container class provides method informations
28   * @author Mike Toggweiler
29   **/
30  public class MethodInfo extends NameDescriptorInfo {
31  
32      public static final String CONSTRUCTOR_NAME = "<init>";
33      public static final String INT_CONSTRUCTOR_NAME = "<clinit>";
34       
35       /**
36        * Create a MethodInfo and initializses itself through the DataInputStream
37        * @param dis the DataInputStream to read from
38        * @param cp the constant pool to resolve indices
39        **/
40      protected MethodInfo(DataInputStream dis, ConstantPool cp) 
41    throws IOException {
42    super(dis, cp);  
43      }
44  
45      /**
46       * Construct a new method with a given access flag, the name and the 
47       * descriptor
48       * @param an instance of a MethodAccessFlags class
49       * @param name the field name
50       * @param descriptor the field descriptor
51       **/
52      public MethodInfo(MethodAccessFlags access, String name, 
53            String descriptor) {
54    super(access, name, descriptor);
55      }
56  
57      /**
58       * Write the constant pool information into a DataOutputStream.
59       * if it is a constructor method, add an additional methodref
60       * @param dos the DataOutputStream to write on     
61       * @param cp the constant pool to store variables
62       **/
63      protected void write(DataOutputStream dos, ConstantPool cp) 
64    throws IOException {  
65    super.write(dos, cp);
66      }
67  
68      /**
69       * @param access the access flag
70       * @return a concrete implementation of the abstract AccessFlags class
71       **/
72      protected AccessFlags getAccessFlags(short access) {
73    return new MethodAccessFlags(access);
74      }
75  
76      /**
77       * @return true if method is a constructor
78       **/
79      public boolean isConstructor() {
80    return getName().equals(MethodInfo.CONSTRUCTOR_NAME);
81      }
82  
83      /**
84       * @return true if method is a constructor
85       **/
86      public boolean isInternalConstructor() {
87    return getName().equals(MethodInfo.INT_CONSTRUCTOR_NAME);
88      }
89  }