Record Class FileWriteRequest

java.lang.Object
java.lang.Record
com.atlassian.secrets.api.FileWriteRequest
Record Components:
file - The path of the file to write to. This should be a valid Path object representing the location where the data should be written.
data - The data to be written to the file. This is a Supplier containing the content that will be written to the specified file.
ignoreIfExists - A boolean flag indicating whether the write operation should be ignored if the file already exists. If true, the file will not be overwritten.
onFileCreated - A Consumer that accepts a Boolean indicating the result of the file creation. This callback is triggered after the attempt to write to the file. The boolean parameter is true if the file was successfully created and false if it was not (e.g., if ignored due to existence).

public record FileWriteRequest(Path file, Supplier<String> data, boolean ignoreIfExists, Consumer<Boolean> onFileCreated) extends Record
A request to write data to a file.

This record represents a request to write data to a specified file path. It includes options to ignore the write if the file already exists and to perform an action when the file is created.

  • Constructor Details

    • FileWriteRequest

      public FileWriteRequest(Path file, Supplier<String> data, boolean ignoreIfExists, Consumer<Boolean> onFileCreated)
      Creates an instance of a FileWriteRequest record class.
      Parameters:
      file - the value for the file record component
      data - the value for the data record component
      ignoreIfExists - the value for the ignoreIfExists record component
      onFileCreated - the value for the onFileCreated record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • file

      public Path file()
      Returns the value of the file record component.
      Returns:
      the value of the file record component
    • data

      public Supplier<String> data()
      Returns the value of the data record component.
      Returns:
      the value of the data record component
    • ignoreIfExists

      public boolean ignoreIfExists()
      Returns the value of the ignoreIfExists record component.
      Returns:
      the value of the ignoreIfExists record component
    • onFileCreated

      public Consumer<Boolean> onFileCreated()
      Returns the value of the onFileCreated record component.
      Returns:
      the value of the onFileCreated record component