Package de.gebit.integrity.ui.utils

## Class JavadocUtil

- java.lang.Object
- - de.gebit.integrity.ui.utils.JavadocUtil

-     public final class JavadocUtil
      extends 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 given `FieldDeclaration` and `IField` refer to the same field.
    `static String` | `getFieldJavadoc​(org.eclipse.jdt.core.IField aField)` | Returns the Javadoc description attached to a given `IField`.
    `protected static String` | `getJavadocMainText​(org.eclipse.jdt.core.dom.Javadoc aJavadoc)` | Returns the main text part from the given Javadoc.
    `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.
    `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.
    `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.
    `protected static org.eclipse.jdt.core.dom.AbstractTypeDeclaration` | `parseCompilationUnit​(org.eclipse.jdt.core.ICompilationUnit aCompilationUnit)` | Returns the `AbstractTypeDeclaration` for the given `ICompilationUnit`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### 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 explore
        `anElementFinder` - the element finder to use for locating the `IJavaElement` to 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 explore
        `anElementFinder` - the element finder to use for locating the `IJavaElement` for the given method
      Returns:
        the Javadoc text, or null if none is available

    - #### getFieldJavadoc

          public static String getFieldJavadoc​(org.eclipse.jdt.core.IField aField)

      Returns the Javadoc description attached to a given `IField`.
      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 field
        `anElementFinder` - the element finder
      Returns:
        the Javadoc text or null if there is none

    - #### getJavadocMainText

          protected static 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 given `FieldDeclaration` and `IField` refer to the same field.
      Parameters:
        `aFieldDeclaration` - the field declaration
        `aField` - 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 the `AbstractTypeDeclaration` for the given `ICompilationUnit`. 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