Class FileGenerator

All Implemented Interfaces:
Generator, TypedGenerator<File>

@API(status=STABLE, since="0.1") @Priority(-1000) public class FileGenerator extends AbstractTypedGenerator<File>
Generator of File values.
Since:
0.1
Version:
1.0, 2022-11
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:
  • Constructor Details

    • FileGenerator

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

    • defaultValue

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

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

      @NotNull public static @NotNull File 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 File 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 File 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