Skip to content

Commit

Permalink
Added missing javadocs
Browse files Browse the repository at this point in the history
  • Loading branch information
ygimenez committed Mar 7, 2023
1 parent 296dea3 commit a899d60
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/github/ygimenez/method/Pages.java
Original file line number Diff line number Diff line change
Expand Up @@ -1690,6 +1690,8 @@ public static void finalizeEvent(Message msg, Consumer<Void> callback) {
* Utility method for switching pages and applying message button states.
*
* @param msg The {@link Message} holding the buttons.
* @param p The current {@link Page}.
* @param helper The {@link BaseHelper} responsible for this event.
* @param changes {@link Map} containing desired changes, indexed by {@link Button} ID.
*/
public static void modifyButtons(Message msg, Page p, BaseHelper<?, ?> helper, Map<String, Function<Button, Button>> changes) {
Expand Down
13 changes: 11 additions & 2 deletions src/main/java/com/github/ygimenez/model/helper/BaseHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* {@link Pages} methods.
*
* @param <Helper> A class that extends {@link BaseHelper}.
* @param <T> The type of collection used to store pages.
* @param <T> The type of collection used to store pages.
*/
public abstract class BaseHelper<Helper extends BaseHelper<Helper, T>, T> {
private final Class<Helper> subClass;
Expand All @@ -30,6 +30,13 @@ public abstract class BaseHelper<Helper extends BaseHelper<Helper, T>, T> {
private long time = 0;
private Predicate<User> canInteract = null;

/**
* Constructor for {@link BaseHelper}.
*
* @param subClass A class that extends {@link BaseHelper}.
* @param buttons The collection used to store pages.
* @param useButtons Whether to use interaction buttons or not.
*/
protected BaseHelper(Class<Helper> subClass, T buttons, boolean useButtons) {
this.subClass = subClass;
this.content = buttons;
Expand Down Expand Up @@ -123,6 +130,8 @@ public Helper setCanInteract(@Nullable Predicate<User> canInteract) {
/**
* Retrieves the {@link List} of {@link Component}s generated by this helper.
*
* @param action A message event (either create or edit).
* @param <Out> Generic for a {@link MessageRequest}
* @return The list of components.
*/
public abstract <Out extends MessageRequest<Out>> List<LayoutComponent> getComponents(Out action);
Expand All @@ -137,8 +146,8 @@ public Helper setCanInteract(@Nullable Predicate<User> canInteract) {
* <pre>{@code helper.apply(channel.sendMessage("Hello world!")).queue();}</pre>
*
* @param action A message event (either create or edit).
* @param <Out> Generic for a {@link MessageRequest}
* @return The same event, but modified to include the buttons.
* @param <Out> Generic for a {@link MessageRequest}
*/
public <Out extends MessageRequest<Out>> Out apply(Out action) {
return action.setComponents(getComponents(action));
Expand Down

0 comments on commit a899d60

Please sign in to comment.