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 resulting UploadResource
uploadId - the only upload id the token can register
maxSize - maximum size of the uploaded file, in bytes
expirationTime - 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 Details

    • UploadToken

      public UploadToken(String username, String uploadId, long maxSize, long expirationTime)
      Creates an instance of a UploadToken record class.
      Parameters:
      username - the value for the username record component
      uploadId - the value for the uploadId record component
      maxSize - the value for the maxSize record component
      expirationTime - the value for the expirationTime record 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 now is at or past the expiration time
    • 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 the compare method from their corresponding wrapper classes.
      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.
    • username

      public String username()
      Returns the value of the username record component.
      Returns:
      the value of the username record component
    • uploadId

      public String uploadId()
      Returns the value of the uploadId record component.
      Returns:
      the value of the uploadId record component
    • maxSize

      public long maxSize()
      Returns the value of the maxSize record component.
      Returns:
      the value of the maxSize record component
    • expirationTime

      public long expirationTime()
      Returns the value of the expirationTime record component.
      Returns:
      the value of the expirationTime record component