Package de.gebit.integrity.ui.utils
Class JavadocUtil
- java.lang.Object
-
- de.gebit.integrity.ui.utils.JavadocUtil
-
public final class JavadocUtil extends java.lang.Object
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
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static boolean
compareFields(org.eclipse.jdt.core.dom.FieldDeclaration aFieldDeclaration, org.eclipse.jdt.core.IField aField)
This checks whether a givenFieldDeclaration
andIField
refer to the same field.static java.lang.String
getFieldJavadoc(org.eclipse.jdt.core.IField aField)
Returns the Javadoc description attached to a givenIField
.protected static java.lang.String
getJavadocMainText(org.eclipse.jdt.core.dom.Javadoc aJavadoc)
Returns the main text part from the given Javadoc.static java.lang.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.static java.lang.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.static java.util.Map<java.lang.String,java.lang.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.protected static org.eclipse.jdt.core.dom.AbstractTypeDeclaration
parseCompilationUnit(org.eclipse.jdt.core.ICompilationUnit aCompilationUnit)
Returns theAbstractTypeDeclaration
for the givenICompilationUnit
.
-
-
-
Method Detail
-
getMethodParamJavadoc
public static java.util.Map<java.lang.String,java.lang.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 theIJavaElement
to the given method- Returns:
- the result map, or null if there is no readable Javadoc at all
-
getMethodJavadoc
public static java.lang.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 theIJavaElement
for the given method- Returns:
- the Javadoc text, or null if none is available
-
getFieldJavadoc
public static java.lang.String getFieldJavadoc(org.eclipse.jdt.core.IField aField)
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 java.lang.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
protected static java.lang.String getJavadocMainText(org.eclipse.jdt.core.dom.Javadoc aJavadoc)
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 givenFieldDeclaration
andIField
refer 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 theAbstractTypeDeclaration
for 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
-
-