Interface IValueBuilder<T>
- Type Parameters:
T- Type of the value created by this builder.
- All Superinterfaces:
org.apache.commons.lang3.builder.Builder<T>, IValueConfigurator
- All Known Subinterfaces:
IAnyValueBuilder, IBooleanValueBuilder, IConstValueBuilder<V>, IFloatValueBuilder, IIntegerValueBuilder, ILargeStringValueBuilder, IListValueBuilder<V>, IMapValueBuilder<V>, INullValueBuilder, IRecordValueBuilder, IStringValueBuilder, ISubTypeValueBuilder<T,Builder>, ITupleValueBuilder, IUnionValueBuilder, IVoidValueBuilder
public interface IValueBuilder<T>
extends IValueConfigurator, org.apache.commons.lang3.builder.Builder<T>
Base interface for builders that can create a value of a certain type. A value builder is usually derived from a
IValueDescriptor and ensures that the values that is built conforms to the restrictions imposed by the value
descriptor.- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
Method Summary
Modifier and TypeMethodDescriptiondefault IBooleanValueBuilderCasts this builder to a boolean value builder.default IConstValueBuilder<?> asConst()Casts this builder to a constant value builder.default IFloatValueBuilderasFloat()Casts this builder to a floating point value builder.default IIntegerValueBuilderCasts this builder to an integer value builder.default <S> IListValueBuilder<S> asList()Casts this builder to a list value builder.default <V> IMapValueBuilder<V> asMap()Casts this builder to a map value builder.default INullValueBuilderasNull()Casts this builder to a null value builder.default IRecordValueBuilderasRecord()Casts this builder to a record value builder.default IStringValueBuilderasString()Casts this builder to a string value builder.default ITupleValueBuilderasTuple()Casts this builder to a tuple value builder.default IUnionValueBuilderasUnion()Casts this builder to a union value builder.default IVoidValueBuilderasVoid()Casts this builder to a void value builder.default booleanis(Class<? extends IValueBuilder> clazz) default <TItem, TBuilder extends IValueBuilder<TItem>>
TBuilderCasts this builder to the given type.Applies the given value to this builder.default IValueBuilder<T> whenBoolean(Consumer<? super IBooleanValueBuilder> action) Execute the given action with this builder as a boolean value builder, if this builder is of that type.default IValueBuilder<T> whenConst(Consumer<? super IConstValueBuilder<?>> action) Execute the given action with this builder as a const value builder, if this builder is of that type.default IValueBuilder<T> whenFloat(Consumer<? super IFloatValueBuilder> action) Execute the given action with this builder as a float value builder, if this builder is of that type.default IValueBuilder<T> whenInteger(Consumer<? super IIntegerValueBuilder> action) Execute the given action with this builder as an integer value builder, if this builder is of that type.default IValueBuilder<T> whenList(Consumer<? super IListValueBuilder<?>> action) Execute the given action with this builder as a list value builder, if this builder is of that type.default IValueBuilder<T> whenMap(Consumer<? super IMapValueBuilder<?>> action) Execute the given action with this builder as a map value builder, if this builder is of that type.default IValueBuilder<T> whenNull(Consumer<? super INullValueBuilder> action) Execute the given action with this builder as a null value builder, if this builder is of that type.default IValueBuilder<T> whenRecord(Consumer<? super IRecordValueBuilder> action) Execute the given action with this builder as a record value builder, if this builder is of that type.default IValueBuilder<T> whenString(Consumer<? super IStringValueBuilder> action) Execute the given action with this builder as a string value builder, if this builder is of that type.default IValueBuilder<T> whenTuple(Consumer<? super ITupleValueBuilder> action) Execute the given action with this builder as a tuple value builder, if this builder is of that type.default IValueConfiguratorwhenUnion(Class<?> discriminatorClass, Consumer<? super IUnionValueBuilder> action) Deprecated.default IValueBuilder<T> whenUnion(Consumer<? super IUnionValueBuilder> action) Execute the given action with this builder as a union value builder, if this builder is of that type.default IValueBuilder<T> whenVoid(Consumer<? super IVoidValueBuilder> action) Execute the given action with this builder as a void value builder, if this builder is of that type.Methods inherited from interface org.apache.commons.lang3.builder.Builder
build
-
Method Details
-
asBoolean
Description copied from interface:IValueConfiguratorCasts this builder to a boolean value builder.- Specified by:
asBooleanin interfaceIValueConfigurator- Returns:
- getThis() builder cast to a boolean value builder.
-
asConst
Description copied from interface:IValueConfiguratorCasts this builder to a constant value builder.- Specified by:
asConstin interfaceIValueConfigurator- Returns:
- getThis() builder cast to a constant value builder.
-
asFloat
Description copied from interface:IValueConfiguratorCasts this builder to a floating point value builder.- Specified by:
asFloatin interfaceIValueConfigurator- Returns:
- getThis() builder cast to a floating point value builder.
-
asInteger
Description copied from interface:IValueConfiguratorCasts this builder to an integer value builder.- Specified by:
asIntegerin interfaceIValueConfigurator- Returns:
- getThis() builder cast to an integer value builder.
-
asList
Description copied from interface:IValueConfiguratorCasts this builder to a list value builder.- Specified by:
asListin interfaceIValueConfigurator- Returns:
- getThis() builder cast to a list value builder.
-
asMap
Description copied from interface:IValueConfiguratorCasts this builder to a map value builder.- Specified by:
asMapin interfaceIValueConfigurator- Returns:
- getThis() builder cast to a map value builder.
-
asNull
Description copied from interface:IValueConfiguratorCasts this builder to a null value builder.- Specified by:
asNullin interfaceIValueConfigurator- Returns:
- getThis() builder cast to a null value builder.
-
asRecord
Description copied from interface:IValueConfiguratorCasts this builder to a record value builder.- Specified by:
asRecordin interfaceIValueConfigurator- Returns:
- getThis() builder cast to a record value builder.
-
asString
Description copied from interface:IValueConfiguratorCasts this builder to a string value builder.- Specified by:
asStringin interfaceIValueConfigurator- Returns:
- getThis() builder cast to a string value builder.
-
asTuple
Description copied from interface:IValueConfiguratorCasts this builder to a tuple value builder.- Specified by:
asTuplein interfaceIValueConfigurator- Returns:
- getThis() builder cast to a tuple value builder.
-
asUnion
Description copied from interface:IValueConfiguratorCasts this builder to a union value builder.- Specified by:
asUnionin interfaceIValueConfigurator- Returns:
- getThis() builder cast to a union value builder.
-
asVoid
Description copied from interface:IValueConfiguratorCasts this builder to a void value builder.- Specified by:
asVoidin interfaceIValueConfigurator- Returns:
- getThis() builder cast to a void value builder.
-
is
- Specified by:
isin interfaceIValueConfigurator- Parameters:
clazz- Class to check.- Returns:
- Whether this builder can be cast to the given class.
- See Also:
-
unwrap
default <TItem, TBuilder extends IValueBuilder<TItem>> TBuilder unwrap(Class<? extends TBuilder> clazz) Description copied from interface:IValueConfiguratorCasts this builder to the given type. Make sure you are certain it is of the given type.- Specified by:
unwrapin interfaceIValueConfigurator- Type Parameters:
TItem- Type of the values described by the descriptor.TBuilder- Type of the builder.- Parameters:
clazz- Class to which to cast this builder.- Returns:
- getThis() value builder cast to the given type.
- See Also:
-
value
Description copied from interface:IValueConfiguratorApplies the given value to this builder. Implementations are allowed to perform validity checks on the passed value and reject the given value or parts of it (in case of lists etc.) when they do not conform to the restrictions imposed by this builder.- Specified by:
valuein interfaceIValueConfigurator- Parameters:
value- Sets the value created by this builder.- Returns:
- getThis() builder instance for chaining method calls.
-
whenBoolean
Description copied from interface:IValueConfiguratorExecute the given action with this builder as a boolean value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenBooleanin interfaceIValueConfigurator- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenConst
Description copied from interface:IValueConfiguratorExecute the given action with this builder as a const value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenConstin interfaceIValueConfigurator- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenFloat
Description copied from interface:IValueConfiguratorExecute the given action with this builder as a float value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenFloatin interfaceIValueConfigurator- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenInteger
Description copied from interface:IValueConfiguratorExecute the given action with this builder as an integer value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenIntegerin interfaceIValueConfigurator- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenList
Description copied from interface:IValueConfiguratorExecute the given action with this builder as a list value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenListin interfaceIValueConfigurator- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenMap
Description copied from interface:IValueConfiguratorExecute the given action with this builder as a map value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenMapin interfaceIValueConfigurator- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenNull
Description copied from interface:IValueConfiguratorExecute the given action with this builder as a null value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenNullin interfaceIValueConfigurator- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenRecord
Description copied from interface:IValueConfiguratorExecute the given action with this builder as a record value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenRecordin interfaceIValueConfigurator- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenString
Description copied from interface:IValueConfiguratorExecute the given action with this builder as a string value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenStringin interfaceIValueConfigurator- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenTuple
Description copied from interface:IValueConfiguratorExecute the given action with this builder as a tuple value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenTuplein interfaceIValueConfigurator- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenUnion
Description copied from interface:IValueConfiguratorExecute the given action with this builder as a union value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenUnionin interfaceIValueConfigurator- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenUnion
@Deprecated default IValueConfigurator whenUnion(Class<?> discriminatorClass, Consumer<? super IUnionValueBuilder> action) Deprecated.Description copied from interface:IValueConfiguratorExecute the given action with this builder as a union value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenUnionin interfaceIValueConfigurator- Parameters:
discriminatorClass- Unusedaction- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenVoid
Description copied from interface:IValueConfiguratorExecute the given action with this builder as a void value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenVoidin interfaceIValueConfigurator- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-