ca.nengo.config
Class JavaSourceParser
java.lang.Object
ca.nengo.config.JavaSourceParser
public class JavaSourceParser
- extends java.lang.Object
Utilities for extracting data from Java source code files, including
variable names and documentation.
- Author:
- Bryan Tripp
Method Summary |
static void |
addSource(java.io.File baseDir)
Adds source code under the given directory to the database. |
static java.lang.String |
getArgDocs(java.lang.reflect.Constructor<?> c,
int arg)
|
static java.lang.String |
getArgDocs(java.lang.reflect.Method m,
int arg)
|
static java.lang.String[] |
getArgNames(java.lang.reflect.Constructor<?> c)
|
static java.lang.String[] |
getArgNames(java.lang.reflect.Method m)
|
static java.lang.String |
getDocs(java.lang.Class<?> c)
|
static java.lang.String |
getDocs(java.lang.reflect.Constructor<?> c)
|
static java.lang.String |
getDocs(java.lang.reflect.Method m)
|
static java.lang.reflect.Method |
getMethod(java.lang.String reference,
java.lang.String referringClassName)
|
static java.lang.String |
getSignature(java.lang.reflect.Method m)
|
static java.lang.String |
removeTags(java.lang.String html)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JavaSourceParser
public JavaSourceParser()
addSource
public static void addSource(java.io.File baseDir)
- Adds source code under the given directory to the database.
- Parameters:
baseDir
- Root directory of source code
getDocs
public static java.lang.String getDocs(java.lang.Class<?> c)
- Parameters:
c
- A Java class
- Returns:
- Class-level documentation if available, othewise null
getMethod
public static java.lang.reflect.Method getMethod(java.lang.String reference,
java.lang.String referringClassName)
throws java.lang.SecurityException,
java.lang.NoSuchMethodException,
java.lang.ClassNotFoundException
- Parameters:
reference
- An see-tag-style reference, ie fully.qualified.ClassName#methodName(ArgType0, ArgType1)referringClassName
- Name of class on which the see tag is written (used to find default package if
arg types are not qualified, and class if undefined)
- Returns:
- Matching Method if possible, otherwise null
- Throws:
java.lang.NoSuchMethodException
java.lang.SecurityException
java.lang.ClassNotFoundException
getDocs
public static java.lang.String getDocs(java.lang.reflect.Method m)
- Parameters:
m
- A Java method
- Returns:
- Method-level documentation if available, otherwise empty string
getDocs
public static java.lang.String getDocs(java.lang.reflect.Constructor<?> c)
- Parameters:
c
- A Java constructor
- Returns:
- Constructor documentation if available, otherwise empty string
getArgNames
public static java.lang.String[] getArgNames(java.lang.reflect.Method m)
- Parameters:
m
- A Java method
- Returns:
- Names of method arguments if available, otherwise the default {"arg0", "arg1", ...}
getArgNames
public static java.lang.String[] getArgNames(java.lang.reflect.Constructor<?> c)
- Parameters:
c
- A Java constructor
- Returns:
- Names of constructor arguments if available, otherwise the default {"arg0", "arg1", ...}
getArgDocs
public static java.lang.String getArgDocs(java.lang.reflect.Method m,
int arg)
- Parameters:
m
- A Java methodarg
- Index of an argument on this method
- Returns:
- Argument documentation if available, otherwise null
getArgDocs
public static java.lang.String getArgDocs(java.lang.reflect.Constructor<?> c,
int arg)
- Parameters:
c
- A Java constructorarg
- Index of an argument on this constructor
- Returns:
- Argument documentation if available, otherwise null
getSignature
public static java.lang.String getSignature(java.lang.reflect.Method m)
- Parameters:
m
- A Java method
- Returns:
- A text representation of the method signature (for display)
removeTags
public static java.lang.String removeTags(java.lang.String html)
- Parameters:
html
- Some text
- Returns:
- The same text with HTML tags removed