Package com.atlassian.secrets.api
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 validPathobject representing the location where the data should be written.data- The data to be written to the file. This is aSuppliercontaining 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- AConsumerthat accepts aBooleanindicating 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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondata()Returns the value of thedatarecord component.final booleanIndicates whether some other object is "equal to" this one.file()Returns the value of thefilerecord component.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theignoreIfExistsrecord component.Returns the value of theonFileCreatedrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
FileWriteRequest
public FileWriteRequest(Path file, Supplier<String> data, boolean ignoreIfExists, Consumer<Boolean> onFileCreated) Creates an instance of aFileWriteRequestrecord class.- Parameters:
file- the value for thefilerecord componentdata- the value for thedatarecord componentignoreIfExists- the value for theignoreIfExistsrecord componentonFileCreated- the value for theonFileCreatedrecord component
-
-
Method Details
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
file
Returns the value of thefilerecord component.- Returns:
- the value of the
filerecord component
-
data
Returns the value of thedatarecord component.- Returns:
- the value of the
datarecord component
-
ignoreIfExists
public boolean ignoreIfExists()Returns the value of theignoreIfExistsrecord component.- Returns:
- the value of the
ignoreIfExistsrecord component
-
onFileCreated
Returns the value of theonFileCreatedrecord component.- Returns:
- the value of the
onFileCreatedrecord component
-