Interface TypeEnvironment


  • public interface TypeEnvironment
    This interface mimics (to an extent) the ProcessingEnvironment and serves the same purpose. To give a context to the API checking classes.
    Since:
    0.1
    Author:
    Lukas Krejci
    • Method Detail

      • getElementUtils

        @Nonnull
        Elements getElementUtils()
        Returns:
        The instance of the utility class to examine the elements of the API (types, methods, etc.)
        See Also:
        Elements
      • getTypeUtils

        @Nonnull
        Types getTypeUtils()
        Returns:
        The instance of the utility class to examine the types in the API.
        See Also:
        Types
      • getModelElement

        JavaTypeElement getModelElement​(TypeElement javaType)
        Returns full Revapi representation of the provided java type. This sort of a reverse to JavaModelElement.getDeclaringElement() on the type level.

        For elements that were not fully analyzed (for example the types included in the Java runtime) a stub implementation is returned that reflects the findings of the analysis but may not reflect the full state of the type (for example use sites not encountered during the analysis will be missing, etc.)

        Parameters:
        javaType - the java type
        Returns:
        revapi model element or null if it cannot be const
      • getModelElement

        default JavaTypeElement getModelElement​(TypeMirror type)
        A variant of getModelElement(TypeElement) that accepts a type mirror. Returns null if the provided type mirror doesn't represent a declared type.
        Parameters:
        type - the type mirror to try and find the model representation of
        Returns:
        the model representation of the type or null if it cannot be found or the type is not a declared type
        See Also:
        getModelElement(TypeElement)