Record Class GuidePage

java.lang.Object
java.lang.Record
ke.ric.api.guide.GuidePage

public record GuidePage(String title, List<GuideEntry> entries, List<GuideListEntry> items, String permission, int totalItems, int windowPage, List<GuideCategory> categories) extends Record
Immutable fixed content and an optional standard 21-item paginated list.
  • Field Details

    • LIST_SLOTS

      public static final List<Integer> LIST_SLOTS
  • Constructor Details

    • GuidePage

      public GuidePage(String title, List<GuideEntry> entries, List<GuideListEntry> items, String permission, int totalItems, int windowPage)
    • GuidePage

      public GuidePage(String title, List<GuideEntry> entries, List<GuideListEntry> items, String permission)
    • GuidePage

      public GuidePage(String title, List<GuideEntry> entries)
    • GuidePage

      public GuidePage(String title, List<GuideEntry> entries, List<GuideListEntry> items)
    • GuidePage

      public GuidePage(String title, List<GuideEntry> entries, List<GuideListEntry> items, String permission, int totalItems, int windowPage, List<GuideCategory> categories)
      Creates an instance of a GuidePage record class.
      Parameters:
      title - the value for the title record component
      entries - the value for the entries record component
      items - the value for the items record component
      permission - the value for the permission record component
      totalItems - the value for the totalItems record component
      windowPage - the value for the windowPage record component
      categories - the value for the categories record component
  • Method Details

    • window

      public static GuidePage window(String title, List<GuideEntry> entries, List<GuideListEntry> items, int totalItems, int pageIndex)
    • windowed

      public boolean windowed()
    • displayPage

      public int displayPage(int requested)
    • itemOffset

      public int itemOffset(int pageIndex)
    • pageSize

      public int pageSize(int pageIndex)
    • categoryTitle

      public String categoryTitle(int pageIndex)
    • categorized

      public static GuidePage categorized(String title, List<GuideEntry> entries, List<GuideCategory> categories)
    • clampPage

      public static int clampPage(int totalItems, int requested)
    • pageCount

      public int pageCount()
    • 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.
    • title

      public String title()
      Returns the value of the title record component.
      Returns:
      the value of the title record component
    • entries

      public List<GuideEntry> entries()
      Returns the value of the entries record component.
      Returns:
      the value of the entries record component
    • items

      public List<GuideListEntry> items()
      Returns the value of the items record component.
      Returns:
      the value of the items record component
    • permission

      public String permission()
      Returns the value of the permission record component.
      Returns:
      the value of the permission record component
    • totalItems

      public int totalItems()
      Returns the value of the totalItems record component.
      Returns:
      the value of the totalItems record component
    • windowPage

      public int windowPage()
      Returns the value of the windowPage record component.
      Returns:
      the value of the windowPage record component
    • categories

      public List<GuideCategory> categories()
      Returns the value of the categories record component.
      Returns:
      the value of the categories record component