Record Class Checkbox

java.lang.Object
java.lang.Record
io.micronaut.views.fields.elements.Checkbox
Record Components:
name - Name of the form control. Submitted with the form as part of a name/value pair
value - A string representing the value of the checkbox.
checked - A boolean attribute indicating whether this checkbox is checked by default (when the page loads).
required - If true indicates that the user must specify a value for the input before the owning form can be submitted.
id - It defines an identifier (ID) which must be unique in the whole document
label - represents a caption for an item in a user interface
All Implemented Interfaces:
GlobalAttributes, FormElement

@Introspected(builder=@IntrospectionBuilder(builderClass=Builder.class)) public record Checkbox(@NonNull String name, @NonNull String value, boolean checked, boolean required, @Nullable String id, @Nullable Message label) extends Record implements FormElement, GlobalAttributes
A Checkbox Form Element.
Since:
4.1.0
Author:
Sergio del Amo
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    Checkbox Builder.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Checkbox(@NonNull String name, @NonNull String value, boolean checked, boolean required, @Nullable String id, @Nullable Message label)
    Creates an instance of a Checkbox record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    static @NonNull Checkbox.Builder
     
    boolean
    Returns the value of the checked record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    @Nullable String
    id()
    Returns the value of the id record component.
    @Nullable Message
    Returns the value of the label record component.
    @NonNull String
    Returns the value of the name record component.
    boolean
    Returns the value of the required record component.
    final String
    Returns a string representation of this record class.
    @NonNull String
    Returns the value of the value record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface io.micronaut.views.fields.FormElement

    getTag
  • Constructor Details

    • Checkbox

      public Checkbox(@NonNull @NonNull String name, @NonNull @NonNull String value, boolean checked, boolean required, @Nullable @Nullable String id, @Nullable @Nullable Message label)
      Creates an instance of a Checkbox record class.
      Parameters:
      name - the value for the name record component
      value - the value for the value record component
      checked - the value for the checked record component
      required - the value for the required record component
      id - the value for the id record component
      label - the value for the label record component
  • Method Details

    • builder

      @NonNull public static @NonNull Checkbox.Builder builder()
      Returns:
      A checkbox builder.
    • 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 '=='.
      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.
    • name

      @NonNull public @NonNull String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • value

      @NonNull public @NonNull String value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component
    • checked

      public boolean checked()
      Returns the value of the checked record component.
      Returns:
      the value of the checked record component
    • required

      public boolean required()
      Returns the value of the required record component.
      Specified by:
      required in interface GlobalAttributes
      Returns:
      the value of the required record component
    • id

      @Nullable public @Nullable String id()
      Returns the value of the id record component.
      Specified by:
      id in interface GlobalAttributes
      Returns:
      the value of the id record component
    • label

      @Nullable public @Nullable Message label()
      Returns the value of the label record component.
      Returns:
      the value of the label record component