Record Class SocialItem

java.lang.Object
java.lang.Record
com.mcawful.social.SocialItem
Record Components:
type - the kind of activity: post, repost, mention, reply or quote
id - the platform's id of the item
authorId - the permanent id of the account that made it
authorName - the account name of its author, such as a handle
authorDisplayName - the display name of its author; may be empty
text - the text of the item; for a repost, the text of the post that was reposted
url - the web address of the item; for a repost, the post that was reposted
createdAt - when the item was seen by the platform, as an ISO-8601 instant

public record SocialItem(String type, String id, String authorId, String authorName, String authorDisplayName, String text, String url, String createdAt) extends Record
One piece of activity on a SocialPlatform
Author:
mcawful
  • Constructor Details

    • SocialItem

      public SocialItem(String type, String id, String authorId, String authorName, String authorDisplayName, String text, String url, String createdAt)
      Creates an instance of a SocialItem record class.
      Parameters:
      type - the value for the type record component
      id - the value for the id record component
      authorId - the value for the authorId record component
      authorName - the value for the authorName record component
      authorDisplayName - the value for the authorDisplayName record component
      text - the value for the text record component
      url - the value for the url record component
      createdAt - the value for the createdAt record component
  • Method Details

    • toJSON

      public String toJSON()
      Returns the item as JSON, as stored in the last_<poll type> setting
      Returns:
      the JSON text
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • type

      public String type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • authorId

      public String authorId()
      Returns the value of the authorId record component.
      Returns:
      the value of the authorId record component
    • authorName

      public String authorName()
      Returns the value of the authorName record component.
      Returns:
      the value of the authorName record component
    • authorDisplayName

      public String authorDisplayName()
      Returns the value of the authorDisplayName record component.
      Returns:
      the value of the authorDisplayName record component
    • text

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

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

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