Record Class UploadToken
java.lang.Object
java.lang.Record
org.exoplatform.upload.UploadToken
- Record Components:
username- user the upload is made for, recorded as the owner of the resultingUploadResourceuploadId- the only upload id the token can registermaxSize- maximum size of the uploaded file, in bytesexpirationTime- time after which the token is refused, in epoch milliseconds
public record UploadToken(String username, String uploadId, long maxSize, long expirationTime)
extends Record
What a one-time upload token authorizes, as
UploadService stores it:
the token value itself is never stored, only its digest, which keys the
entry.-
Constructor Summary
ConstructorsConstructorDescriptionUploadToken(String username, String uploadId, long maxSize, long expirationTime) Creates an instance of aUploadTokenrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.longReturns the value of theexpirationTimerecord component.final inthashCode()Returns a hash code value for this object.booleanisExpired(long now) Tells whether the token can no longer be used.longmaxSize()Returns the value of themaxSizerecord component.final StringtoString()Returns a string representation of this record class.uploadId()Returns the value of theuploadIdrecord component.username()Returns the value of theusernamerecord component.
-
Constructor Details
-
UploadToken
Creates an instance of aUploadTokenrecord class.- Parameters:
username- the value for theusernamerecord componentuploadId- the value for theuploadIdrecord componentmaxSize- the value for themaxSizerecord componentexpirationTime- the value for theexpirationTimerecord component
-
-
Method Details
-
isExpired
public boolean isExpired(long now) Tells whether the token can no longer be used.- Parameters:
now- current time in epoch milliseconds- Returns:
- true when
nowis at or past the expiration time
-
toString
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
username
-
uploadId
-
maxSize
-
expirationTime
public long expirationTime()Returns the value of theexpirationTimerecord component.- Returns:
- the value of the
expirationTimerecord component
-