Class FieldDefinitionBuilder
java.lang.Object
com.commercetools.history.models.common.FieldDefinitionBuilder
- All Implemented Interfaces:
Builder<FieldDefinition>
FieldDefinitionBuilder
Example to create an instance using the builder pattern
Example to create an instance using the builder pattern
FieldDefinition fieldDefinition = FieldDefinition.builder()
.type(typeBuilder -> typeBuilder)
.name("{name}")
.label(labelBuilder -> labelBuilder)
.inputHint(TextInputHint.SINGLE_LINE)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
builds FieldDefinition with checking for non-null required valuesbuilds FieldDefinition without checking for non-null required valuesvalue of inputHint}getLabel()
value of label}getName()
The name of the field.getType()
value of type}inputHint
(TextInputHint inputHint) set the value to the inputHintlabel
(LocalizedString label) set the value to the labelset the value to the label using the builder functionThe name of the field.static FieldDefinitionBuilder
of()
factory method for an instance of FieldDefinitionBuilderstatic FieldDefinitionBuilder
of
(FieldDefinition template) create builder for FieldDefinition instanceset the value to the typetype
(Function<FieldTypeBuilder, FieldTypeBuilder> builder) set the value to the type using the builder functionset the value to the label using the builder functionwithType
(Function<FieldTypeBuilder, FieldType> builder) set the value to the type using the builder function
-
Constructor Details
-
FieldDefinitionBuilder
public FieldDefinitionBuilder()
-
-
Method Details
-
type
set the value to the type using the builder function- Parameters:
builder
- function to build the type value- Returns:
- Builder
-
withType
set the value to the type using the builder function- Parameters:
builder
- function to build the type value- Returns:
- Builder
-
type
set the value to the type- Parameters:
type
- value to be set- Returns:
- Builder
-
name
The name of the field. The name must be between two and 36 characters long and can contain the ASCII letters A to Z in lowercase or uppercase, digits, underscores (
_
) and the hyphen-minus (-
). The name must be unique for a given resource type ID. In case there is a field with the same name in another type it has to have the same FieldType also.- Parameters:
name
- value to be set- Returns:
- Builder
-
label
public FieldDefinitionBuilder label(Function<LocalizedStringBuilder, LocalizedStringBuilder> builder) set the value to the label using the builder function- Parameters:
builder
- function to build the label value- Returns:
- Builder
-
withLabel
set the value to the label using the builder function- Parameters:
builder
- function to build the label value- Returns:
- Builder
-
label
set the value to the label- Parameters:
label
- value to be set- Returns:
- Builder
-
inputHint
set the value to the inputHint- Parameters:
inputHint
- value to be set- Returns:
- Builder
-
getType
value of type}- Returns:
- type
-
getName
The name of the field. The name must be between two and 36 characters long and can contain the ASCII letters A to Z in lowercase or uppercase, digits, underscores (
_
) and the hyphen-minus (-
). The name must be unique for a given resource type ID. In case there is a field with the same name in another type it has to have the same FieldType also.- Returns:
- name
-
getLabel
value of label}- Returns:
- label
-
getInputHint
value of inputHint}- Returns:
- inputHint
-
build
builds FieldDefinition with checking for non-null required values- Specified by:
build
in interfaceBuilder<FieldDefinition>
- Returns:
- FieldDefinition
-
buildUnchecked
builds FieldDefinition without checking for non-null required values- Returns:
- FieldDefinition
-
of
factory method for an instance of FieldDefinitionBuilder- Returns:
- builder
-
of
create builder for FieldDefinition instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-