Class AttachmentImpl
java.lang.Object
com.mewna.catnip.entity.impl.message.AttachmentImpl
- All Implemented Interfaces:
Entity
,Message.Attachment
,Snowflake
,Timestamped
,RequiresCatnip
- Since:
- 8/5/19.
- Author:
- amy
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.mewna.catnip.entity.partials.Timestamped
Timestamped.TimestampStyle
-
Constructor Summary
ConstructorDescriptionAttachmentImpl
(Catnip catnip, long idAsLong, String fileName, int size, String url, String proxyUrl, int height, int width, boolean ephemeral) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
catnip()
Returns the catnip instance associated with this entity.void
boolean
Indicates whether or not this attachment is ephemeral.ephemeral
(boolean ephemeral) boolean
fileName()
The name of the file represented by this attachment.int
hashCode()
int
height()
The height of this attachment, if it's an image.height
(int height) long
idAsLong()
The ID of this snowflake, as a long.idAsLong
(long idAsLong) proxyUrl()
The proxied URL for the file.int
size()
The size of the file represented by this attachment, in bytes.size
(int size) toString()
url()
The source URL for the file.int
width()
The width of this attachment, if it's an image.width
(int width) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.mewna.catnip.entity.message.Message.Attachment
image
Methods inherited from interface com.mewna.catnip.entity.partials.Snowflake
creationTime, creationTimestamp, id
Methods inherited from interface com.mewna.catnip.entity.partials.Timestamped
asDiscordTimestamp, parseTimestamp
-
Constructor Details
-
AttachmentImpl
public AttachmentImpl() -
AttachmentImpl
-
-
Method Details
-
catnip
- Specified by:
catnip
in interfaceRequiresCatnip
-
hashCode
public int hashCode() -
equals
-
toString
-
builder
-
catnip
Description copied from interface:Entity
Returns the catnip instance associated with this entity. -
idAsLong
public long idAsLong()Description copied from interface:Snowflake
The ID of this snowflake, as a long. -
fileName
Description copied from interface:Message.Attachment
The name of the file represented by this attachment.- Specified by:
fileName
in interfaceMessage.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 interfaceMessage.Attachment
- Returns:
- Integer representing the file size. Never negative.
-
url
Description copied from interface:Message.Attachment
The source URL for the file.- Specified by:
url
in interfaceMessage.Attachment
- Returns:
- String representing the source URL. Never null.
-
proxyUrl
Description copied from interface:Message.Attachment
The proxied URL for the file.- Specified by:
proxyUrl
in interfaceMessage.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 interfaceMessage.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 interfaceMessage.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 interfaceMessage.Attachment
- Returns:
- Whether this attachment is ephemeral.
-
idAsLong
- Returns:
this
.
-
fileName
- Returns:
this
.
-
size
- Returns:
this
.
-
url
- Returns:
this
.
-
proxyUrl
- Returns:
this
.
-
height
- Returns:
this
.
-
width
- Returns:
this
.
-
ephemeral
- Returns:
this
.
-