Package com.opencloud.rem.common.form
Class FieldValueProviderBuilder
- java.lang.Object
-
- com.opencloud.rem.common.form.FieldValueProviderBuilder
-
public class FieldValueProviderBuilder extends Object
Used to construct a new
FieldValueProvider
.Usage example:
FieldValueProvider fieldValueProvider = FieldValueProviderBuilder.newFieldValueProvider() .addValue("Foo", "foo") .addValue("Bar", "bar") .restrictive() .build();
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description FieldValueProviderBuilder
addContext(String key, String value)
Adds a context entry to theFieldValueProvider
, to be used when calculating the field's values at display time.FieldValueProviderBuilder
addNamedValue(String name, String value)
Adds a single value to theFieldValueProvider
using the specified name as its name.FieldValueProviderBuilder
addNamedValues(Map<String,String> namedValues)
Adds all the given named values to theFieldValueProvider
.FieldValueProviderBuilder
addValue(String value)
Adds a single value to theFieldValueProvider
using the value itself as the name.FieldValueProviderBuilder
addValues(Collection<String> values)
Adds all the given values to theFieldValueProvider
using the values themselves as the names.FieldValueProvider
build()
Builds a newFieldValueProvider
using the values provided by thisFieldValueProvider
.FieldValueProviderBuilder
dynamic()
Marks thisFieldValueProvider
as dynamic, meaning that the field's values are expected to be calculated at display time.FieldValueProviderBuilder
dynamic(boolean dynamic)
Sets thisFieldValueProvider
's dynamic flag.static FieldValueProviderBuilder
newFieldValueProvider()
Starts building a newFieldValueProvider
.FieldValueProviderBuilder
restrictive()
Marks thisFieldValueProvider
as restrictive, meaning that the corresponding field should be restricted to the provided values.FieldValueProviderBuilder
restrictive(boolean restrictive)
Sets thisFieldValueProvider
's restrictive flag.
-
-
-
Method Detail
-
newFieldValueProvider
public static FieldValueProviderBuilder newFieldValueProvider()
Starts building a newFieldValueProvider
.- Returns:
- a new
FieldValueProviderBuilder
-
addValue
public FieldValueProviderBuilder addValue(String value)
Adds a single value to theFieldValueProvider
using the value itself as the name.- Parameters:
value
- the value to add- Returns:
- the
FieldValueProviderBuilder
being used to construct thisFieldValueProvider
-
addValues
public FieldValueProviderBuilder addValues(Collection<String> values)
Adds all the given values to theFieldValueProvider
using the values themselves as the names.- Parameters:
values
- aCollection
of values to add- Returns:
- the
FieldValueProviderBuilder
being used to construct thisFieldValueProvider
-
addNamedValue
public FieldValueProviderBuilder addNamedValue(String name, String value)
Adds a single value to theFieldValueProvider
using the specified name as its name.- Parameters:
name
- the name of the valuevalue
- the value to add- Returns:
- the
FieldValueProviderBuilder
being used to construct thisFieldValueProvider
-
addNamedValues
public FieldValueProviderBuilder addNamedValues(Map<String,String> namedValues)
Adds all the given named values to theFieldValueProvider
.- Parameters:
namedValues
- aMap
of named values to add- Returns:
- the
FieldValueProviderBuilder
being used to construct thisFieldValueProvider
-
restrictive
public FieldValueProviderBuilder restrictive()
Marks thisFieldValueProvider
as restrictive, meaning that the corresponding field should be restricted to the provided values.- Returns:
- the
FieldValueProviderBuilder
being used to construct thisFieldValueProvider
-
restrictive
public FieldValueProviderBuilder restrictive(boolean restrictive)
Sets thisFieldValueProvider
's restrictive flag.- Parameters:
restrictive
-true
if the field should be restricted to the provided values (default isfalse
)- Returns:
- the
FieldValueProviderBuilder
being used to construct thisFieldValueProvider
-
dynamic
public FieldValueProviderBuilder dynamic()
Marks thisFieldValueProvider
as dynamic, meaning that the field's values are expected to be calculated at display time.- Returns:
- the
FieldValueProviderBuilder
being used to construct thisFieldValueProvider
-
dynamic
public FieldValueProviderBuilder dynamic(boolean dynamic)
Sets thisFieldValueProvider
's dynamic flag.- Parameters:
dynamic
-true
if the field's values are expected to be calculated at display time (default isfalse
)- Returns:
- the
FieldValueProviderBuilder
being used to construct thisFieldValueProvider
-
addContext
public FieldValueProviderBuilder addContext(String key, String value)
Adds a context entry to theFieldValueProvider
, to be used when calculating the field's values at display time.- Parameters:
key
- the key of the context entryvalue
- the value of the context entry- Returns:
- the
FieldValueProviderBuilder
being used to construct thisFieldValueProvider
-
build
public FieldValueProvider build()
Builds a newFieldValueProvider
using the values provided by thisFieldValueProvider
.- Returns:
- the new
FieldValueProvider
-
-