Package io.openems.edge.core.appmanager
Class JsonFormlyUtil.InputBuilder
java.lang.Object
io.openems.edge.core.appmanager.JsonFormlyUtil.FormlyBuilder<JsonFormlyUtil.InputBuilder>
io.openems.edge.core.appmanager.JsonFormlyUtil.InputBuilder
- All Implemented Interfaces:
OnlyIf<JsonFormlyUtil.InputBuilder>
,Self<JsonFormlyUtil.InputBuilder>
- Enclosing class:
- JsonFormlyUtil
public static final class JsonFormlyUtil.InputBuilder
extends JsonFormlyUtil.FormlyBuilder<JsonFormlyUtil.InputBuilder>
A Builder for a Formly Input.
{ "key": "key", "type": "input", "templateOptions": { "type": "number", "label": "label", "placeholder": "placeholder", "required": true, "min": 0, "max": 100, "minLenght": 6, "maxLenght": 18, "pattern": /(\d{1,3}\.){3}\d{1,3}/ }, "validation": { "messages": { "pattern": "Input is not a valid IP Address!", }, }, "expressionProperties": { "templateOptions.required": "model.PROPERTY" }, "hideExpression": "!model.PROPERTY", "defaultValue": "defaultValue" }
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
static enum
-
Field Summary
Fields inherited from class io.openems.edge.core.appmanager.JsonFormlyUtil.FormlyBuilder
jsonObject, templateOptions
-
Method Summary
Modifier and TypeMethodDescriptioncom.google.gson.JsonObject
build()
protected String
getType()
protected final com.google.gson.JsonObject
Sets the type of the input.setMax
(int max) Sets the max value of the input.setMaxLenght
(int maxLength) Sets the minLength of the input.setMin
(int min) Sets the min value of the input.setMinLenght
(int minLength) Sets the minLength of the input.setPlaceholder
(String placeholder) setValidation
(JsonFormlyUtil.InputBuilder.Validation validation) Sets the validation of the Input.Methods inherited from class io.openems.edge.core.appmanager.JsonFormlyUtil.FormlyBuilder
addWrapper, getExpressionProperties, isRequired, onlyShowIf, onlyShowIfChecked, onlyShowIfNotChecked, onlyShowIfValueEquals, self, setDefaultValue, setDefaultValue, setDefaultValue, setDefaultValue, setDefaultValueCases, setDefaultValueWithBooleanSupplier, setDefaultValueWithStringSupplier, setDescription, setKey, setLabel, setLabelExpression
-
Method Details
-
setInputType
Sets the type of the input.- Parameters:
type
- to be set- Returns:
- this
-
setPlaceholder
-
setMin
Sets the min value of the input.- Parameters:
min
- the min number that can be set- Returns:
- this
- Throws:
IllegalArgumentException
- if the type is not set to number
-
setMax
Sets the max value of the input.- Parameters:
max
- the max number that can be set- Returns:
- this
- Throws:
IllegalArgumentException
- if the type is not set to number
-
setMinLenght
Sets the minLength of the input.- Parameters:
minLength
- the min length the input needs- Returns:
- this
- Throws:
IllegalArgumentException
- if the type is not set to password or text
-
setMaxLenght
Sets the minLength of the input.- Parameters:
maxLength
- the max length the input needs- Returns:
- this
- Throws:
IllegalArgumentException
- if the type is not set to password or text
-
setValidation
Sets the validation of the Input.e. g. to set the validation of an IP use
JsonFormlyUtil.InputBuilder.Validation.IP
- Parameters:
validation
- the validation to be set- Returns:
- this
-
getType
- Specified by:
getType
in classJsonFormlyUtil.FormlyBuilder<JsonFormlyUtil.InputBuilder>
-
build
public com.google.gson.JsonObject build()- Overrides:
build
in classJsonFormlyUtil.FormlyBuilder<JsonFormlyUtil.InputBuilder>
-
getValidation
protected final com.google.gson.JsonObject getValidation()
-