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 pairvalue
- 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 documentlabel
- 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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull Checkbox.Builder
builder()
boolean
checked()
Returns the value of thechecked
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.@Nullable String
id()
Returns the value of theid
record component.@Nullable Message
label()
Returns the value of thelabel
record component.@NonNull String
name()
Returns the value of thename
record component.boolean
required()
Returns the value of therequired
record component.final String
toString()
Returns a string representation of this record class.@NonNull String
value()
Returns the value of thevalue
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 aCheckbox
record class.- Parameters:
name
- the value for thename
record componentvalue
- the value for thevalue
record componentchecked
- the value for thechecked
record componentrequired
- the value for therequired
record componentid
- the value for theid
record componentlabel
- the value for thelabel
record component
-
-
Method Details
-
builder
- Returns:
- A checkbox builder.
-
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. -
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. -
equals
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 withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
name
Returns the value of thename
record component.- Returns:
- the value of the
name
record component
-
value
Returns the value of thevalue
record component.- Returns:
- the value of the
value
record component
-
checked
public boolean checked()Returns the value of thechecked
record component.- Returns:
- the value of the
checked
record component
-
required
public boolean required()Returns the value of therequired
record component.- Specified by:
required
in interfaceGlobalAttributes
- Returns:
- the value of the
required
record component
-
id
Returns the value of theid
record component.- Specified by:
id
in interfaceGlobalAttributes
- Returns:
- the value of the
id
record component
-
label
Returns the value of thelabel
record component.- Returns:
- the value of the
label
record component
-