Class ParamReader
- java.lang.Object
-
- java.io.InputStream
-
- java.io.ByteArrayInputStream
-
- org.apache.axis2.description.java2wsdl.bytecode.ClassReader
-
- org.apache.axis2.description.java2wsdl.bytecode.ParamReader
-
- All Implemented Interfaces:
Closeable,AutoCloseable
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.
-
-
Field Summary
-
Fields inherited from class java.io.ByteArrayInputStream
buf, count, mark, pos
-
-
Constructor Summary
Constructors Constructor Description ParamReader(byte[] b)Processes the given class bytes directly.ParamReader(Class c)Processes a class file, given it's class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String[]getParameterNames(Constructor ctor)Returns the names of the declared parameters for the given constructor.protected String[]getParameterNames(Member member, Class[] paramTypes)String[]getParameterNames(Method method)Returns the names of the declared parameters for the given method.voidreadCode()Reads a code attribute.voidreadLocalVariableTable()This is invoked when a LocalVariableTable attribute is encountered.-
Methods inherited from class org.apache.axis2.description.java2wsdl.bytecode.ClassReader
findAttributeReaders, getBytes, getSignature, readAttributes, readCpool, readInt, readShort, resolveClass, resolveField, resolveMethod, resolveNameAndType, resolveUtf8, skipAttributes, skipFully
-
Methods inherited from class java.io.ByteArrayInputStream
available, close, mark, markSupported, read, read, readAllBytes, readNBytes, reset, skip, transferTo
-
Methods inherited from class java.io.InputStream
nullInputStream, read, readNBytes
-
-
-
-
Constructor Detail
-
ParamReader
public ParamReader(Class c) throws IOException
Processes a class file, given it's class. We'll use the defining classloader to locate the bytecode.- Parameters:
c-- Throws:
IOException
-
ParamReader
public ParamReader(byte[] b) throws IOExceptionProcesses the given class bytes directly.- Parameters:
b-- Throws:
IOException
-
-
Method Detail
-
readCode
public void readCode() throws IOExceptionDescription copied from class:ClassReaderReads a code attribute.- Overrides:
readCodein classClassReader- Throws:
IOException
-
getParameterNames
public String[] getParameterNames(Constructor ctor)
Returns 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().- Parameters:
ctor-- Returns:
- Returns String[] array of names, one per parameter, or null
-
getParameterNames
public String[] getParameterNames(Method method)
Returns 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().- Parameters:
method-- Returns:
- Returns String[] array of names, one per parameter, or null
-
readLocalVariableTable
public void readLocalVariableTable() throws IOExceptionThis is invoked when a LocalVariableTable attribute is encountered.- Throws:
IOException
-
-