Record Class RemoveComponentFunction

java.lang.Object
java.lang.Record
io.github.toberocat.guiengine.function.call.RemoveComponentFunction
All Implemented Interfaces:
GuiFunction

public record RemoveComponentFunction(@NotNull String target) extends Record implements GuiFunction
Custom GUI function to remove a component from the GUI.

Created: 29.04.2023 Author: Tobias Madlberger (Tobias)

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static class 
    Custom deserializer to convert JSON data into a `RemoveComponentFunction` instance.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of a RemoveComponentFunction record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    call(@NotNull GuiEngineApi api, @NotNull GuiContext context)
    Calls the `removeById` method using the provided API and context to remove a component from the GUI.
    final boolean
    Indicates whether some other object is "equal to" this one.
    @NotNull String
     
    final int
    Returns a hash code value for this object.
    @NotNull String
    Returns the value of the target record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • RemoveComponentFunction

      public RemoveComponentFunction(@NotNull @NotNull String target)
      Creates an instance of a RemoveComponentFunction record class.
      Parameters:
      target - the value for the target record component
  • Method Details

    • getType

      @NotNull public @NotNull String getType()
      Specified by:
      getType in interface GuiFunction
    • call

      public void call(@NotNull @NotNull GuiEngineApi api, @NotNull @NotNull GuiContext context)
      Calls the `removeById` method using the provided API and context to remove a component from the GUI.
      Specified by:
      call in interface GuiFunction
      Parameters:
      api - The `GuiEngineApi` instance used to interact with the GUI engine.
      context - The `GuiContext` instance representing the GUI context from which to remove the component.
    • 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.
    • target

      @NotNull public @NotNull String target()
      Returns the value of the target record component.
      Returns:
      the value of the target record component