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

Quick Search    Search Deep

org.apache.axis.utils.bytecode
Class ParamReader  view ParamReader download ParamReader.java

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.ByteArrayInputStream
          extended byorg.apache.axis.utils.bytecode.ClassReader
              extended byorg.apache.axis.utils.bytecode.ParamReader
All Implemented Interfaces:
java.io.Closeable

public class ParamReader
extends ClassReader

This is the class file reader for obtaining the parameter names for declared methods in a class. The class must have debugging attributes for us to obtain this information.

This does not work for inherited methods. To obtain parameter names for inherited methods, you must use a paramReader for the class that originally declared the method.

don't get tricky, it's the bare minimum. Instances of this class are not threadsafe -- don't share them.


Nested Class Summary
private static class ParamReader.MethodInfo
           
 
Nested classes inherited from class org.apache.axis.utils.bytecode.ClassReader
 
Field Summary
private  java.lang.String methodName
           
private  java.util.Map methods
           
private  java.lang.Class[] paramTypes
           
 
Fields inherited from class org.apache.axis.utils.bytecode.ClassReader
 
Fields inherited from class java.io.ByteArrayInputStream
buf, count, mark, pos
 
Constructor Summary
ParamReader(byte[] b)
          process the given class bytes directly.
ParamReader(java.lang.Class c)
          process a class file, given it's class.
 
Method Summary
private  ParamReader.MethodInfo getMethodInfo()
           
 java.lang.String[] getParameterNames(java.lang.reflect.Constructor ctor)
          return the names of the declared parameters for the given constructor.
protected  java.lang.String[] getParameterNames(java.lang.reflect.Member member, java.lang.Class[] paramTypes)
           
 java.lang.String[] getParameterNames(java.lang.reflect.Method method)
          return the names of the declared parameters for the given method.
 void readCode()
          read a code attribute
 void readLocalVariableTable()
          this is invoked when a LocalVariableTable attribute is encountered.
 
Methods inherited from class org.apache.axis.utils.bytecode.ClassReader
classDescriptorToName, findAttributeReaders, getBytes, getSignature, readAttributes, readCpool, readInt, readShort, resolveClass, resolveField, resolveMethod, resolveNameAndType, resolveUtf8, skipAttributes, skipFully
 
Methods inherited from class java.io.ByteArrayInputStream
available, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.io.InputStream
close, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

methodName

private java.lang.String methodName

methods

private java.util.Map methods

paramTypes

private java.lang.Class[] paramTypes
Constructor Detail

ParamReader

public ParamReader(java.lang.Class c)
            throws java.io.IOException
process a class file, given it's class. We'll use the defining classloader to locate the bytecode.


ParamReader

public ParamReader(byte[] b)
            throws java.io.IOException
process the given class bytes directly.

Method Detail

readCode

public void readCode()
              throws java.io.IOException
Description copied from class: ClassReader
read a code attribute

Overrides:
readCode in class ClassReader

getParameterNames

public java.lang.String[] getParameterNames(java.lang.reflect.Constructor ctor)
return the names of the declared parameters for the given constructor. If we cannot determine the names, return null. The returned array will have one name per parameter. The length of the array will be the same as the length of the Class[] array returned by Constructor.getParameterTypes().


getParameterNames

public java.lang.String[] getParameterNames(java.lang.reflect.Method method)
return the names of the declared parameters for the given method. If we cannot determine the names, return null. The returned array will have one name per parameter. The length of the array will be the same as the length of the Class[] array returned by Method.getParameterTypes().


getParameterNames

protected java.lang.String[] getParameterNames(java.lang.reflect.Member member,
                                               java.lang.Class[] paramTypes)

getMethodInfo

private ParamReader.MethodInfo getMethodInfo()

readLocalVariableTable

public void readLocalVariableTable()
                            throws java.io.IOException
this is invoked when a LocalVariableTable attribute is encountered.