org.cojen.classfile
Class MethodDeclarationParser

java.lang.Object
  extended by org.cojen.classfile.MethodDeclarationParser

public class MethodDeclarationParser
extends Object

Utility class that supports parsing of Java method declarations. For example, public static int myMethod(java.lang.String, int value, java.lang.String... extra).

The parser is fairly lenient. It doesn't care if the set of modifiers is illegal, and it doesn't require that arguments have variable names assigned. A semi-colon may appear at the end of the signature.

At most one variable argument is supported (at the end), and all class names must be fully qualified.

Author:
Brian S O'Neill

Constructor Summary
MethodDeclarationParser(String declaration)
          Parse the given method declaration, throwing a exception if the syntax is wrong.
 
Method Summary
 String getMethodName()
           
 Modifiers getModifiers()
           
 TypeDesc[] getParameters()
           
 TypeDesc getReturnType()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodDeclarationParser

public MethodDeclarationParser(String declaration)
                        throws IllegalArgumentException
Parse the given method declaration, throwing a exception if the syntax is wrong.

Parameters:
declaration - declaration to parse, which matches Java syntax
Throws:
IllegalArgumentException - if declaration syntax is wrong
Method Detail

getModifiers

public Modifiers getModifiers()

getReturnType

public TypeDesc getReturnType()

getMethodName

public String getMethodName()

getParameters

public TypeDesc[] getParameters()


Copyright © 2004-2011 Brian S O'Neill. All Rights Reserved.