Package rocks.xmpp.extensions.data.model
Class DataForm.Field.Builder
- java.lang.Object
-
- rocks.xmpp.extensions.data.model.DataForm.Field.Builder
-
- Enclosing class:
- DataForm.Field
public static final class DataForm.Field.Builder extends Object
A builder class to build a data form field.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description DataForm.Field
build()
Builds the field.DataForm.Field.Builder
description(String description)
Sets the description.DataForm.Field.Builder
label(String label)
Sets the label.DataForm.Field.Builder
media(Media media)
Sets the media element.DataForm.Field.Builder
name(String name)
Sets the var attribute.DataForm.Field.Builder
options(Collection<DataForm.Option> options)
Sets the options.DataForm.Field.Builder
required(boolean required)
Sets if the field is required.DataForm.Field.Builder
type(DataForm.Field.Type type)
Sets the type of the field.DataForm.Field.Builder
validation(Validation validation)
Sets the validation.DataForm.Field.Builder
value(boolean value)
Sets the value as boolean.DataForm.Field.Builder
value(int value)
Sets the value as integer.DataForm.Field.Builder
value(String value)
Sets the value as string.DataForm.Field.Builder
value(Instant instant)
Sets the value as date.DataForm.Field.Builder
value(Jid value)
Sets the value as JID.DataForm.Field.Builder
values(Collection<String> values)
Sets the values.DataForm.Field.Builder
valuesEnum(Collection<? extends Enum<?>> values)
Sets the values from an enum.DataForm.Field.Builder
valuesJid(Collection<Jid> values)
Sets the values as JIDs.DataForm.Field.Builder
var(String name)
Deprecated.Usename(String)
-
-
-
Method Detail
-
type
public final DataForm.Field.Builder type(DataForm.Field.Type type)
Sets the type of the field.- Parameters:
type
- The field type.- Returns:
- The builder.
-
required
public final DataForm.Field.Builder required(boolean required)
Sets if the field is required.- Parameters:
required
- If the field is required.- Returns:
- The builder.
-
description
public final DataForm.Field.Builder description(String description)
Sets the description.- Parameters:
description
- The description.- Returns:
- The builder.
-
media
public final DataForm.Field.Builder media(Media media)
Sets the media element.- Parameters:
media
- The media element.- Returns:
- The builder.
-
validation
public final DataForm.Field.Builder validation(Validation validation)
Sets the validation.- Parameters:
validation
- The validation.- Returns:
- The builder.
-
label
public final DataForm.Field.Builder label(String label)
Sets the label.- Parameters:
label
- The label.- Returns:
- The builder.
-
var
@Deprecated public final DataForm.Field.Builder var(String name)
Deprecated.Usename(String)
Sets the var attribute.- Parameters:
name
- The var attribute.- Returns:
- The builder.
-
name
public final DataForm.Field.Builder name(String name)
Sets the var attribute.- Parameters:
name
- The var attribute.- Returns:
- The builder.
-
value
public final DataForm.Field.Builder value(String value)
Sets the value as string.- Parameters:
value
- The value.- Returns:
- The builder.
-
value
public final DataForm.Field.Builder value(boolean value)
Sets the value as boolean. This methods sets the field type implicitly toDataForm.Field.Type.BOOLEAN
.- Parameters:
value
- The value.- Returns:
- The builder.
-
value
public final DataForm.Field.Builder value(int value)
Sets the value as integer. This methods sets the field type implicitly toDataForm.Field.Type.TEXT_SINGLE
.- Parameters:
value
- The value.- Returns:
- The builder.
-
value
public final DataForm.Field.Builder value(Jid value)
Sets the value as JID. This methods sets the field type implicitly toDataForm.Field.Type.JID_SINGLE
.- Parameters:
value
- The value.- Returns:
- The builder.
-
value
public final DataForm.Field.Builder value(Instant instant)
Sets the value as date. This methods sets the field type implicitly toDataForm.Field.Type.TEXT_SINGLE
.- Parameters:
instant
- The value.- Returns:
- The builder.
-
values
public final DataForm.Field.Builder values(Collection<String> values)
Sets the values. This methods sets the field type implicitly toDataForm.Field.Type.TEXT_MULTI
.- Parameters:
values
- The values.- Returns:
- The builder.
-
valuesEnum
public final DataForm.Field.Builder valuesEnum(Collection<? extends Enum<?>> values)
Sets the values from an enum. This methods sets the field type implicitly toDataForm.Field.Type.LIST_SINGLE
.- Parameters:
values
- The values.- Returns:
- The builder.
-
valuesJid
public final DataForm.Field.Builder valuesJid(Collection<Jid> values)
Sets the values as JIDs. This methods sets the field type implicitly toDataForm.Field.Type.JID_MULTI
.- Parameters:
values
- The values.- Returns:
- The builder.
-
options
public final DataForm.Field.Builder options(Collection<DataForm.Option> options)
Sets the options.- Parameters:
options
- The options.- Returns:
- The builder.
-
build
public final DataForm.Field build()
Builds the field.- Returns:
- The field.
-
-