Class PathGenerator

All Implemented Interfaces:
Generator, TypedGenerator<Path>

@API(status=STABLE, since="0.1") @Priority(-1000) public class PathGenerator extends AbstractTypedGenerator<Path>
Generator of Path values.
Since:
0.1
Version:
1.0, 2022-10
Author:
(w) Iker Hernaez
  • Field Details

    • WORKING_DIR_PROP

      public static final String WORKING_DIR_PROP
      System property for working directory path.
      See Also:
    • USER_DIR_PROP

      public static final String USER_DIR_PROP
      System property for user home directory path.
      See Also:
    • TMP_DIR_PROP

      public static final String TMP_DIR_PROP
      System property for temporary files directory path.
      See Also:
    • SEPARATOR

      public static final String SEPARATOR
      The default file system separator.
  • Constructor Details

    • PathGenerator

      public PathGenerator()
      Creates a new instance.
  • Method Details

    • defaultValue

      @NotNull public @NotNull Path defaultValue()
      Returns the default value of the supported type.
      Returns:
      The default value.
    • randomValue

      @NotNull public @NotNull Path randomValue()
      Returns a random value of the supported type.
      Returns:
      A random value.
    • workingDir

      @NotNull public static @NotNull Path workingDir()
      Returns the current working directory.
      Returns:
      The current working directory
    • workingPath

      @NotNull public static @NotNull String workingPath()
      Returns the current working directory path.
      Returns:
      The current working directory path
    • userDir

      @NotNull public static @NotNull Path userDir()
      Returns the current user's home directory.
      Returns:
      The current user's home directory
    • userPath

      @NotNull public static @NotNull String userPath()
      Returns the current user's home directory path.
      Returns:
      The current user's home directory path
    • tmpDir

      @NotNull public static @NotNull Path tmpDir()
      Returns the default temporary file directory.
      Returns:
      The default temporary file directory
    • tmpPath

      @NotNull public static @NotNull String tmpPath()
      Returns the default temporary file directory path.
      Returns:
      The default temporary file directory path
    • randomPath

      @NotNull public static @NotNull String randomPath()
      Generate a random path.
      Returns:
      The generated random path
    • randomPathSegment

      @NotNull public static @NotNull String randomPathSegment()
      Generate a random path segment.
      Returns:
      The generated random path
    • removeLastSeparator

      @NotNull protected static @NotNull String removeLastSeparator(@NotNull @NotNull String path)
      Removes the last file path separator from the path if exists.

      In some environments some paths end with separator while other paths don't. This methods removes de incoherence.

      Parameters:
      path - The path
      Returns:
      The path without trailing separator