Class AttachmentImpl

java.lang.Object
com.mewna.catnip.entity.impl.message.AttachmentImpl
All Implemented Interfaces:
Entity, Message.Attachment, Snowflake, Timestamped, RequiresCatnip

public class AttachmentImpl extends Object implements Message.Attachment, RequiresCatnip
Since:
8/5/19.
Author:
amy
  • Constructor Details

    • AttachmentImpl

      public AttachmentImpl()
    • AttachmentImpl

      public AttachmentImpl(Catnip catnip, long idAsLong, String fileName, int size, String url, String proxyUrl, int height, int width, boolean ephemeral)
  • Method Details

    • catnip

      public void catnip(@Nonnull Catnip catnip)
      Specified by:
      catnip in interface RequiresCatnip
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • builder

      public static AttachmentImpl.AttachmentImplBuilder builder()
    • catnip

      public Catnip catnip()
      Description copied from interface: Entity
      Returns the catnip instance associated with this entity.
      Specified by:
      catnip in interface Entity
      Returns:
      The catnip instance of this entity.
    • idAsLong

      public long idAsLong()
      Description copied from interface: Snowflake
      The ID of this snowflake, as a long.
      Specified by:
      idAsLong in interface Snowflake
      Returns:
      Long representing the ID.
    • fileName

      public String fileName()
      Description copied from interface: Message.Attachment
      The name of the file represented by this attachment.
      Specified by:
      fileName in interface Message.Attachment
      Returns:
      String representing the file name. Never null.
    • size

      public int size()
      Description copied from interface: Message.Attachment
      The size of the file represented by this attachment, in bytes.
      Specified by:
      size in interface Message.Attachment
      Returns:
      Integer representing the file size. Never negative.
    • url

      public String url()
      Description copied from interface: Message.Attachment
      The source URL for the file.
      Specified by:
      url in interface Message.Attachment
      Returns:
      String representing the source URL. Never null.
    • proxyUrl

      public String proxyUrl()
      Description copied from interface: Message.Attachment
      The proxied URL for the file.
      Specified by:
      proxyUrl in interface Message.Attachment
      Returns:
      String representing the proxied URL. Never null.
    • height

      public int height()
      Description copied from interface: Message.Attachment
      The height of this attachment, if it's an image.
      Specified by:
      height in interface Message.Attachment
      Returns:
      Integer representing the height, or -1 if this attachment is not an image.
    • width

      public int width()
      Description copied from interface: Message.Attachment
      The width of this attachment, if it's an image.
      Specified by:
      width in interface Message.Attachment
      Returns:
      Integer representing the width, or -1 if this attachment is not an image.
    • ephemeral

      public boolean ephemeral()
      Description copied from interface: Message.Attachment
      Indicates whether or not this attachment is ephemeral. Ephemeral attachments are automatically removed after a set period of time, the duration of which is unfortunately not documented. Ephemeral attachments are guaranteed to exist for at least as long as their containing message exists.
      Specified by:
      ephemeral in interface Message.Attachment
      Returns:
      Whether this attachment is ephemeral.
    • idAsLong

      public AttachmentImpl idAsLong(long idAsLong)
      Returns:
      this.
    • fileName

      public AttachmentImpl fileName(String fileName)
      Returns:
      this.
    • size

      public AttachmentImpl size(int size)
      Returns:
      this.
    • url

      public AttachmentImpl url(String url)
      Returns:
      this.
    • proxyUrl

      public AttachmentImpl proxyUrl(String proxyUrl)
      Returns:
      this.
    • height

      public AttachmentImpl height(int height)
      Returns:
      this.
    • width

      public AttachmentImpl width(int width)
      Returns:
      this.
    • ephemeral

      public AttachmentImpl ephemeral(boolean ephemeral)
      Returns:
      this.