org.teleal.lemma.reader.javacode
Class LineRangeParser

java.lang.Object
  extended by org.teleal.lemma.reader.javacode.LineRangeParser

public class LineRangeParser
extends Object

Finds the "line range" of declarations in a Java source file.

We need this to demarcate raw source code for citation, where a method/nested class begins and where it ends. The challenge is matching the Javadoc metadata of a method to this parser's metadata of a method. Javadoc has knowledge of the type system (e.g. qualified vs. unqualified parameters of a method are detectable) while this parser only has the declared string as-is from the source file and there is no way we can qualify/unqualify a method parameter type. So calculating a method signature here might have a different result than calculating a method signature in the Javadoc reader.

In other words, don't be surprised when the source lines of a method can't be found if you use qualified type names on method parameters in your source.

TODO: Revisit this and see if it helps: http://code.google.com/p/javaparser/issues/detail?id=9

Author:
Christian Bauer

Field Summary
protected  Map<String,LineRange> methodsLineRange
           
protected  Map<String,LineRange> typesLineRange
           
 
Constructor Summary
LineRangeParser(File file)
           
 
Method Summary
 Map<String,LineRange> getMethodsLineRange()
           
protected  String getSignature(japa.parser.ast.body.MethodDeclaration methodDeclaration)
           
 Map<String,LineRange> getTypesLineRange()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

methodsLineRange

protected final Map<String,LineRange> methodsLineRange

typesLineRange

protected final Map<String,LineRange> typesLineRange
Constructor Detail

LineRangeParser

public LineRangeParser(File file)
                throws IOException,
                       japa.parser.ParseException
Throws:
IOException
japa.parser.ParseException
Method Detail

getMethodsLineRange

public Map<String,LineRange> getMethodsLineRange()

getTypesLineRange

public Map<String,LineRange> getTypesLineRange()

getSignature

protected String getSignature(japa.parser.ast.body.MethodDeclaration methodDeclaration)


Copyright © 2011 Teleal GmbH, Switzerland. All Rights Reserved.