Package com.vaadin.flow.server.streams
Record Class UploadResult
java.lang.Object
java.lang.Record
com.vaadin.flow.server.streams.UploadResult
- Record Components:
success-trueif the upload was successful,falseotherwiseresponse- the response object for the upload requestexception- the exception that caused the failure, ornullif successful or no exception availableacceptedFiles- list of file names that were acceptedrejectedFiles- list of rejected files with their rejection reasons
- All Implemented Interfaces:
Serializable
public record UploadResult(boolean success, VaadinResponse response, Exception exception, List<String> acceptedFiles, List<UploadResult.RejectedFile> rejectedFiles)
extends Record
implements Serializable
Represents the result of an upload operation.
This record encapsulates the outcome of processing an upload request, including whether it was successful, the response object, any exception that may have occurred, and lists of accepted and rejected files.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRepresents a rejected file with its rejection reason. -
Constructor Summary
ConstructorsConstructorDescriptionUploadResult(boolean success, VaadinResponse response) Creates an upload result without an exception or file tracking.UploadResult(boolean success, VaadinResponse response, Exception exception) Creates an upload result with an exception but no file tracking.UploadResult(boolean success, VaadinResponse response, Exception exception, List<String> acceptedFiles, List<UploadResult.RejectedFile> rejectedFiles) Creates an instance of aUploadResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theacceptedFilesrecord component.booleanChecks if all files were accepted.booleanChecks if all files were rejected.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theexceptionrecord component.booleanhasFiles()Checks if any files were processed.final inthashCode()Returns a hash code value for this object.booleanhasMixed()Checks if there is a mix of accepted and rejected files.Returns the value of therejectedFilesrecord component.response()Returns the value of theresponserecord component.booleansuccess()Returns the value of thesuccessrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
UploadResult
Creates an upload result without an exception or file tracking.- Parameters:
success-trueif the upload was successful,falseotherwiseresponse- the response object for the upload request
-
UploadResult
Creates an upload result with an exception but no file tracking.- Parameters:
success-trueif the upload was successful,falseotherwiseresponse- the response object for the upload requestexception- the exception that caused the failure
-
UploadResult
public UploadResult(boolean success, VaadinResponse response, Exception exception, List<String> acceptedFiles, List<UploadResult.RejectedFile> rejectedFiles) Creates an instance of aUploadResultrecord class.- Parameters:
success- the value for thesuccessrecord componentresponse- the value for theresponserecord componentexception- the value for theexceptionrecord componentacceptedFiles- the value for theacceptedFilesrecord componentrejectedFiles- the value for therejectedFilesrecord component
-
-
Method Details
-
allAccepted
public boolean allAccepted()Checks if all files were accepted.- Returns:
trueif there are accepted files and no rejected files
-
allRejected
public boolean allRejected()Checks if all files were rejected.- Returns:
trueif there are rejected files and no accepted files
-
hasMixed
public boolean hasMixed()Checks if there is a mix of accepted and rejected files.- Returns:
trueif there are both accepted and rejected files
-
hasFiles
public boolean hasFiles()Checks if any files were processed.- Returns:
trueif there are any accepted or rejected files
-
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 '=='. -
success
public boolean success()Returns the value of thesuccessrecord component.- Returns:
- the value of the
successrecord component
-
response
Returns the value of theresponserecord component.- Returns:
- the value of the
responserecord component
-
exception
Returns the value of theexceptionrecord component.- Returns:
- the value of the
exceptionrecord component
-
acceptedFiles
Returns the value of theacceptedFilesrecord component.- Returns:
- the value of the
acceptedFilesrecord component
-
rejectedFiles
Returns the value of therejectedFilesrecord component.- Returns:
- the value of the
rejectedFilesrecord component
-