Record Class Option

java.lang.Object
java.lang.Record
io.micronaut.views.fields.elements.Option
Record Components:
selected - If present, this Boolean attribute indicates that the option is initially selected.
disabled - If this Boolean attribute is set, this option is not checkable.
value - The content of this attribute represents the value to be submitted with the form, should this option be selected.
label - This attribute is text for the label indicating the meaning of the option.
All Implemented Interfaces:
FormElement

@Introspected(builder=@IntrospectionBuilder(builderClass=Builder.class)) public record Option(boolean disabled, boolean selected, @NonNull String value, @NonNull Message label) extends Record implements FormElement
HTML Option. Option
Since:
4.1.0
Author:
Sergio del Amo
  • Nested Class Summary

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

    Constructors
    Constructor
    Description
    Option(boolean disabled, boolean selected, @NonNull String value, @NonNull Message label)
    Creates an instance of a Option record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    static @NonNull Option.Builder
     
    boolean
    Returns the value of the disabled record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    @NonNull HtmlTag
     
    final int
    Returns a hash code value for this object.
    @NonNull Message
    Returns the value of the label record component.
    boolean
    Returns the value of the selected 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
  • Constructor Details

    • Option

      public Option(boolean disabled, boolean selected, @NonNull @NonNull String value, @NonNull @NonNull Message label)
      Creates an instance of a Option record class.
      Parameters:
      disabled - the value for the disabled record component
      selected - the value for the selected record component
      value - the value for the value record component
      label - the value for the label record component
  • Method Details

    • builder

      @NonNull public static @NonNull Option.Builder builder()
      Returns:
      Option Builder.
    • getTag

      @NonNull public @NonNull HtmlTag getTag()
      Specified by:
      getTag in interface FormElement
      Returns:
      The HTML Tag this element refers to.
    • 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.
    • disabled

      public boolean disabled()
      Returns the value of the disabled record component.
      Returns:
      the value of the disabled record component
    • selected

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

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

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