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).disabled- A boolean attribute indicating whether this checkbox is disabled 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 disabled, 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 -
Constructor Summary
ConstructorsConstructorDescriptionCheckbox(@NonNull String name, @NonNull String value, boolean checked, boolean disabled, boolean required, @Nullable String id, @Nullable Message label) Creates an instance of aCheckboxrecord class.Checkbox(@NonNull String name, @NonNull String value, boolean checked, boolean required, @Nullable String id, @Nullable Message label) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull Checkbox.Builderbuilder()booleanchecked()Returns the value of thecheckedrecord component.booleandisabled()Returns the value of thedisabledrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@Nullable Stringid()Returns the value of theidrecord component.@Nullable Messagelabel()Returns the value of thelabelrecord component.@NonNull Stringname()Returns the value of thenamerecord component.booleanrequired()Returns the value of therequiredrecord component.final StringtoString()Returns a string representation of this record class.@NonNull Stringvalue()Returns the value of thevaluerecord component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.micronaut.views.fields.FormElement
getTag
-
Constructor Details
-
Checkbox
@Deprecated(forRemoval=true, since="5.2.0") public Checkbox(@NonNull @NonNull String name, @NonNull @NonNull String value, boolean checked, boolean required, @Nullable @Nullable String id, @Nullable @Nullable Message label) Deprecated, for removal: This API element is subject to removal in a future version.UseCheckbox(@io.micronaut.core.annotation.NonNull java.lang.String,@io.micronaut.core.annotation.NonNull java.lang.String,boolean,boolean,boolean,@io.micronaut.core.annotation.Nullable java.lang.String,@io.micronaut.core.annotation.Nullable io.micronaut.views.fields.messages.Message)instead which includes disabled attribute.Instantiates a Checkbox.- Parameters:
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
-
Checkbox
public Checkbox(@NonNull @NonNull String name, @NonNull @NonNull String value, boolean checked, boolean disabled, boolean required, @Nullable @Nullable String id, @Nullable @Nullable Message label) Creates an instance of aCheckboxrecord class.- Parameters:
name- the value for thenamerecord componentvalue- the value for thevaluerecord componentchecked- the value for thecheckedrecord componentdisabled- the value for thedisabledrecord componentrequired- the value for therequiredrecord componentid- the value for theidrecord componentlabel- the value for thelabelrecord 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 thenamerecord component.- Returns:
- the value of the
namerecord component
-
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-
checked
public boolean checked()Returns the value of thecheckedrecord component.- Returns:
- the value of the
checkedrecord component
-
disabled
public boolean disabled()Returns the value of thedisabledrecord component.- Returns:
- the value of the
disabledrecord component
-
required
public boolean required()Returns the value of therequiredrecord component.- Specified by:
requiredin interfaceGlobalAttributes- Returns:
- the value of the
requiredrecord component
-
id
Returns the value of theidrecord component.- Specified by:
idin interfaceGlobalAttributes- Returns:
- the value of the
idrecord component
-
label
Returns the value of thelabelrecord component.- Returns:
- the value of the
labelrecord component
-
Checkbox(@io.micronaut.core.annotation.NonNull java.lang.String,@io.micronaut.core.annotation.NonNull java.lang.String,boolean,boolean,boolean,@io.micronaut.core.annotation.Nullable java.lang.String,@io.micronaut.core.annotation.Nullable io.micronaut.views.fields.messages.Message)instead which includes disabled attribute.