Interface AppImageLayout

All Known Subinterfaces:
ApplicationLayout, RuntimeLayout
All Known Implementing Classes:
AppImageLayout.Stub

public interface AppImageLayout
Generic app image directory layout. App image layout is a collection of files and directories with specific roles (executables, configuration files, etc.) sharing the same root directory.

The layout is "unresolved" if the root directory is an empty path (Path.of("")) and "resolved" otherwise.

The return value of the runtimeDirectory() method call is always a path starting with the path returned by the rootDirectory() method call. Public methods without parameters and with the return type Path in the derived interfaces must comply to this constrain.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
    Default implementation of AppImageLayout interface.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Returns true if the root directory of this app image layout is not an empty path, i.e, if it is not equal to Path.of("").
    Returns a copy of this app image layout with the specified mapper applied to every path.
    Returns a copy of this app image layout with the root directory set to an empty path (Path.of("")) or this instance if its root directory is already an empty path.
    Creates a copy of this app image layout resolved at the given root directory.
    Root directory of this app image layout.
    A path to Java runtime directory.
    static PathGroup
    toPathGroup(AppImageLayout appImageLayout)
    Creates PathGroup object from the given AppImageLayout instance.
    Returns a copy of this app image layout resolved such that its root directory is set to an empty path (Path.of("")) or this instance if its root directory is already an empty path.
  • Method Details

    • runtimeDirectory

      Path runtimeDirectory()
      A path to Java runtime directory. The directory should have standard JDK subdirectories like "bin", "lib", etc.
      Returns:
      Java runtime sub-directory within this app image
    • rootDirectory

      Path rootDirectory()
      Root directory of this app image layout. It should normally be equal to Path.of("") for unresolved layout.
      Returns:
      the root directory of this app image layout
    • resetRootDirectory

      AppImageLayout resetRootDirectory()
      Returns a copy of this app image layout with the root directory set to an empty path (Path.of("")) or this instance if its root directory is already an empty path.
      Returns:
      an app image layout with the root directory set to an empty path
    • isResolved

      default boolean isResolved()
      Returns true if the root directory of this app image layout is not an empty path, i.e, if it is not equal to Path.of("").
      Returns:
      true if the root directory of this app image layout is not an empty path
    • resolveAt

      default AppImageLayout resolveAt(Path root)
      Creates a copy of this app image layout resolved at the given root directory.
      Parameters:
      root - path to a directory at which to resolve the layout
      Returns:
      a copy of this app image layout resolved at the given root directory
    • unresolve

      default AppImageLayout unresolve()
      Returns a copy of this app image layout resolved such that its root directory is set to an empty path (Path.of("")) or this instance if its root directory is already an empty path.
      Returns:
      an app image layout resolved at Path.of("") path
    • map

      Returns a copy of this app image layout with the specified mapper applied to every path.
      Parameters:
      mapper - the mapper to use with every path in this app image layout.
      Returns:
      the copy of this app image layout with the specified mapper applied to every path
    • toPathGroup

      static PathGroup toPathGroup(AppImageLayout appImageLayout)
      Creates PathGroup object from the given AppImageLayout instance. It will call every non-static accessible method without parameters and with Path return type of the given AppImageLayout instance except rootDirectory() method.

      For every call, it will save the return value in the output PathGroup object under the key equals the name of a function used in the call.

      Parameters:
      appImageLayout - source layout object
      Returns:
      PathGroup object constructed from the given source layout object