Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Parser for java Class

  1. #1
    Junior Member
    Join Date
    Nov 2010
    Thanked 0 Times in 0 Posts

    Default Parser for java Class


    I want to extract this information from a java file:

    1- Name of class and its fields variables
    2- Name of methods and its parameters
    3- List of local variables in a method


    I know there is a general purpose library named ANTLR that is used for the parsing stuff, but it is too coarse and low level parser? Do you have any idea of a library ( may be wrapper ANTLR ) that helps me to extract the above mentioned information from a java file.


  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Thanked 619 Times in 561 Posts
    Blog Entries

    Default Re: Parser for java Class

    The default Java runtime is able to parse through compiled classes via reflection. Link: Trail: The Reflection API (The Java™ Tutorials). Hopefully that's what you're looking for, though. You cannot pull out local variables using this method (not sure about private/protected variables/methods, either).

Similar Threads

  1. Java Parser
    By sid0009 in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: August 20th, 2010, 11:06 AM
  2. SAX Parser will not add object to arrayList
    By michaelz in forum What's Wrong With My Code?
    Replies: 7
    Last Post: July 1st, 2010, 02:59 PM
  3. XML DOM Parser problem
    By kanishktew in forum What's Wrong With My Code?
    Replies: 0
    Last Post: April 10th, 2010, 09:42 PM
  4. where can i get a Dom Parser jar ?
    By chinni in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: November 26th, 2009, 02:41 AM
  5. Infix to Prefix parser
    By r2ro_serolf in forum Java Theory & Questions
    Replies: 1
    Last Post: November 8th, 2009, 12:11 AM