Package io.jmix.flowui.download
Record Class DownloadContext
java.lang.Object
java.lang.Record
io.jmix.flowui.download.DownloadContext
- Record Components:
dataProvider- the provider supplying the data to be downloadedfileName- the name of the file to be downloadedcontentType- the MIME type of the filecacheMaxAgeSec- the maximum time in seconds the file will be considered relevant for caching purposesdownload-trueif the file should be downloaded,falseif it should be viewed
public record DownloadContext(DownloadDataProvider dataProvider, String fileName, String contentType, int cacheMaxAgeSec, boolean download)
extends Record
Represents the context for a file download operation. This class encapsulates relevant metadata and
data provider information to facilitate the downloading of a file.
-
Constructor Summary
ConstructorsConstructorDescriptionDownloadContext(DownloadDataProvider dataProvider, String fileName, String contentType, int cacheMaxAgeSec, boolean download) Creates an instance of aDownloadContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the maximum time in seconds during which the file will be considered relevant.Returns the value of thecontentTyperecord component.Returns the value of thedataProviderrecord component.booleandownload()Returns the value of thedownloadrecord component.final booleanIndicates whether some other object is "equal to" this one.fileName()Returns the value of thefileNamerecord component.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
DownloadContext
public DownloadContext(DownloadDataProvider dataProvider, String fileName, String contentType, int cacheMaxAgeSec, boolean download) Creates an instance of aDownloadContextrecord class.- Parameters:
dataProvider- the value for thedataProviderrecord componentfileName- the value for thefileNamerecord componentcontentType- the value for thecontentTyperecord componentcacheMaxAgeSec- the value for thecacheMaxAgeSecrecord componentdownload- the value for thedownloadrecord component
-
-
Method Details
-
cacheMaxAgeSec
public int cacheMaxAgeSec()Returns the maximum time in seconds during which the file will be considered relevant. Makes sense for using the built-in PDF viewer in the Chrome browser.- See Also:
-
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 '=='. -
dataProvider
Returns the value of thedataProviderrecord component.- Returns:
- the value of the
dataProviderrecord component
-
fileName
Returns the value of thefileNamerecord component.- Returns:
- the value of the
fileNamerecord component
-
contentType
Returns the value of thecontentTyperecord component.- Returns:
- the value of the
contentTyperecord component
-
download
public boolean download()Returns the value of thedownloadrecord component.- Returns:
- the value of the
downloadrecord component
-