Record Class StoredMedia

java.lang.Object
java.lang.Record
com.onec.ui.media.StoredMedia
Record Components:
key - the storage-internal identifier (opaque to clients; e.g. a date-sharded path for the filesystem backend, or an object key for S3)
url - the address the UI/clients use to fetch the binary back — a framework route (e.g. /api/media/2026/06/<uuid>.jpg) for the filesystem backend, or an absolute object-store URL for backends that serve directly
contentType - the stored content type (as accepted; never null)
size - the stored size in bytes
filename - the original client filename, sanitized; may be null if none was sent

public record StoredMedia(String key, String url, String contentType, long size, String filename) extends Record
A reference to a stored binary, returned from MediaStorage.store(java.io.InputStream, java.lang.String, java.lang.String, long) and serialized as the JSON body of POST /api/media. The url is what callers persist into a file/ image attribute (or a newline-joined gallery value) — never the bytes themselves.
  • Constructor Details

    • StoredMedia

      public StoredMedia(String key, String url, String contentType, long size, String filename)
      Creates an instance of a StoredMedia record class.
      Parameters:
      key - the value for the key record component
      url - the value for the url record component
      contentType - the value for the contentType record component
      size - the value for the size record component
      filename - the value for the filename record component
  • Method Details

    • 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 '=='.
      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.
    • key

      public String key()
      Returns the value of the key record component.
      Returns:
      the value of the key record component
    • url

      public String url()
      Returns the value of the url record component.
      Returns:
      the value of the url record component
    • contentType

      public String contentType()
      Returns the value of the contentType record component.
      Returns:
      the value of the contentType record component
    • size

      public long size()
      Returns the value of the size record component.
      Returns:
      the value of the size record component
    • filename

      public String filename()
      Returns the value of the filename record component.
      Returns:
      the value of the filename record component