Interface CodeContribution

All Superinterfaces:
Resource
All Known Subinterfaces:
AppJarFile, ClasspathElement, ClassTree, JavaResourceTree, LibraryJarFile, ModulePathElement, MvnRepoLibraryJarFile
All Known Implementing Classes:
DefaultClassTree, DefaultJavaResourceTree, DefaultLibraryJarFile, DefaultMvnRepoLibraryJarFile

public interface CodeContribution extends Resource
Common base interface for resources that can be used in either a classpath or a module-path.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Checks whether this code contribution is modular.
    static boolean
    Checks whether the code contribution is modular.
    default Optional<String>
    Returns the module name if this element is a named module.
    Return the representation of the element as it must appear on a classpath or module-path.

    Methods inherited from interface Resource

    asOf, asOfLocalized, cleanup, isNewerThan, name, type
  • Method Details

    • toPath

      Return the representation of the element as it must appear on a classpath or module-path.
      Returns:
      the path
    • isModular

      static boolean isModular(CodeContribution contribution)

      Checks whether the code contribution is modular. This works for both JAR files and directories. Both are considered as modular if they contain a module-info.class. JARs are also considered as modular if they have an Automatic-Module-Name set in their MANIFEST.MF.

      This is provided as static method in order to simplify reuse in classes implementing this interface.

      Parameters:
      contribution - the contribution
      Returns:
      true, if the contribution is modular
    • isModular

      default boolean isModular()
      Checks whether this code contribution is modular. This works for both JAR files and directories. Both are considered as modular if they contain a module-info.class. JARs are also considered as modular if they have an Automatic-Module-Name set in their MANIFEST.MF.
      Returns:
      true, if the contribution is modular
    • moduleName

      Returns the module name if this element is a named module.
      Returns:
      the optional module name