org.teleal.lemma.reader.javacode
Class LineRangeParser
java.lang.Object
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
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
methodsLineRange
protected final Map<String,LineRange> methodsLineRange
typesLineRange
protected final Map<String,LineRange> typesLineRange
LineRangeParser
public LineRangeParser(File file)
throws IOException,
japa.parser.ParseException
- Throws:
IOException
japa.parser.ParseException
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.