Package de.gebit.integrity.ui.utils
Class JavadocUtil
java.lang.Object
de.gebit.integrity.ui.utils.JavadocUtil
This utility class contains various helper functions to aid in the exploration of Javadoc data attached to classes.
Only for use inside Eclipse!
- Author:
- Rene Schneider - initial API and implementation
-
Method Summary
Modifier and TypeMethodDescriptionprotected static booleancompareFields(org.eclipse.jdt.core.dom.FieldDeclaration aFieldDeclaration, org.eclipse.jdt.core.IField aField) This checks whether a givenFieldDeclarationandIFieldrefer to the same field.static StringgetFieldJavadoc(org.eclipse.jdt.core.IField aField) Returns the Javadoc description attached to a givenIField.protected static StringgetJavadocMainText(org.eclipse.jdt.core.dom.Javadoc aJavadoc) Returns the main text part from the given Javadoc.static StringgetJvmFieldJavadoc(org.eclipse.xtext.common.types.JvmField aField, org.eclipse.xtext.common.types.util.jdt.IJavaElementFinder anElementFinder) Returns the Javadoc text attached to a given field.static StringgetMethodJavadoc(org.eclipse.xtext.common.types.JvmOperation aMethod, org.eclipse.xtext.common.types.util.jdt.IJavaElementFinder anElementFinder) Returns the Javadoc text attached to a given Java Method.getMethodParamJavadoc(org.eclipse.xtext.common.types.JvmOperation aMethod, org.eclipse.xtext.common.types.util.jdt.IJavaElementFinder anElementFinder) Returns a map of parameter names to Javadoc descriptions for a given Java method.protected static org.eclipse.jdt.core.dom.AbstractTypeDeclarationparseCompilationUnit(org.eclipse.jdt.core.ICompilationUnit aCompilationUnit) Returns theAbstractTypeDeclarationfor the givenICompilationUnit.
-
Method Details
-
getMethodParamJavadoc
public static Map<String,String> getMethodParamJavadoc(org.eclipse.xtext.common.types.JvmOperation aMethod, org.eclipse.xtext.common.types.util.jdt.IJavaElementFinder anElementFinder) Returns a map of parameter names to Javadoc descriptions for a given Java method. This explores the @param Javadoc parameter. Parameters which don't have such an information attached will not be put into the resulting map.- Parameters:
aMethod- the Java method to exploreanElementFinder- the element finder to use for locating theIJavaElementto the given method- Returns:
- the result map, or null if there is no readable Javadoc at all
-
getMethodJavadoc
public static String getMethodJavadoc(org.eclipse.xtext.common.types.JvmOperation aMethod, org.eclipse.xtext.common.types.util.jdt.IJavaElementFinder anElementFinder) Returns the Javadoc text attached to a given Java Method.- Parameters:
aMethod- the method to exploreanElementFinder- the element finder to use for locating theIJavaElementfor the given method- Returns:
- the Javadoc text, or null if none is available
-
getFieldJavadoc
Returns the Javadoc description attached to a givenIField.- Parameters:
aField- the field to explore- Returns:
- the Javadoc String, or null if there is none
-
getJvmFieldJavadoc
public static String getJvmFieldJavadoc(org.eclipse.xtext.common.types.JvmField aField, org.eclipse.xtext.common.types.util.jdt.IJavaElementFinder anElementFinder) Returns the Javadoc text attached to a given field.- Parameters:
aField- the fieldanElementFinder- the element finder- Returns:
- the Javadoc text or null if there is none
-
getJavadocMainText
Returns the main text part from the given Javadoc.- Parameters:
aJavadoc- the Javadoc object to explore- Returns:
- the text, or null if there is none
-
compareFields
protected static boolean compareFields(org.eclipse.jdt.core.dom.FieldDeclaration aFieldDeclaration, org.eclipse.jdt.core.IField aField) This checks whether a givenFieldDeclarationandIFieldrefer to the same field.- Parameters:
aFieldDeclaration- the field declarationaField- the field- Returns:
- true if both refer to the same field, false otherwise
-
parseCompilationUnit
protected static org.eclipse.jdt.core.dom.AbstractTypeDeclaration parseCompilationUnit(org.eclipse.jdt.core.ICompilationUnit aCompilationUnit) Returns theAbstractTypeDeclarationfor the givenICompilationUnit. This basically parses the given compilation unit into an Abstract Syntax Tree, using the parser provided by the JDT for the job.- Parameters:
aCompilationUnit- the compilation unit to parse- Returns:
- the AST
-