Package revxrsal.commands.help
Interface CommandHelp<T>
- Type Parameters:
T
- The help entry type. SeeCommandHelpWriter
for more information.
- All Superinterfaces:
Collection<T>
,Iterable<T>
,List<T>
Represents an iterable of the entries generated by the
CommandHelpWriter
.
This class contains useful methods to allow paginating the help entries.
-
Method Summary
Modifier and TypeMethodDescription@org.jetbrains.annotations.Range(from=1L, to=9223372036854775807L) int
getPageSize
(int elementsPerPage) Returns the number of pages that would be generated when including x elements per page.paginate
(int page, int elementsPerPage) Returns aCommandHelp
that contains the help entries in a paginated mannerMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
-
Method Details
-
paginate
Returns aCommandHelp
that contains the help entries in a paginated manner- Parameters:
page
- Page to include elements ofelementsPerPage
- The elements to include in each page- Returns:
- The new command help
- Throws:
InvalidHelpPageException
-
getPageSize
@org.jetbrains.annotations.Range(from=1L, to=9223372036854775807L) int getPageSize(int elementsPerPage) Returns the number of pages that would be generated when including x elements per page.- Parameters:
elementsPerPage
- Elements to include in each page. Must be at least 1- Returns:
- The page size
- Throws:
IllegalArgumentException
- if elementsPerPage is less than 1.
-