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<D>
,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 aIValueDescriptor
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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default IBooleanValueBuilder
asBoolean()
Casts this builder to a boolean value builder.default IConstValueBuilder<?>
asConst()
Casts this builder to a constant value builder.default IFloatValueBuilder
asFloat()
Casts this builder to a floating point value builder.default IIntegerValueBuilder
asInteger()
Casts 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 INullValueBuilder
asNull()
Casts this builder to a null value builder.default IRecordValueBuilder
asRecord()
Casts this builder to a record value builder.default IStringValueBuilder
asString()
Casts this builder to a string value builder.default ITupleValueBuilder
asTuple()
Casts this builder to a tuple value builder.default IUnionValueBuilder<?>
asUnion()
Casts this builder to a union value builder.default IVoidValueBuilder
asVoid()
Casts this builder to a void value builder.default boolean
is(Class<? extends IValueBuilder> clazz)
default <TItem,TBuilder extends IValueBuilder<TItem>>
TBuilderunwrap(Class<? extends TBuilder> clazz)
Casts this builder to the given type.IValueBuilder<T>
value(Object value)
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 a 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 <D> IValueConfigurator
whenUnion(Class<D> discriminatorClass, Consumer<? super IUnionValueBuilder<D>> action)
Execute the given action with this builder as a union value builder, if this builder is of that type.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.
-
-
-
Method Detail
-
whenBoolean
default IValueBuilder<T> whenBoolean(Consumer<? super IBooleanValueBuilder> action)
Description copied from interface:IValueConfigurator
Execute the given action with this builder as a boolean value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenBoolean
in interfaceIValueConfigurator
- Parameters:
action
- Action to execute if this builder is of the desired type.- Returns:
- getThis() builder instance to chain method calls.
-
whenConst
default IValueBuilder<T> whenConst(Consumer<? super IConstValueBuilder<?>> action)
Description copied from interface:IValueConfigurator
Execute the given action with this builder as a const value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenConst
in interfaceIValueConfigurator
- Parameters:
action
- Action to execute if this builder is of the desired type.- Returns:
- getThis() builder instance to chain method calls.
-
whenFloat
default IValueBuilder<T> whenFloat(Consumer<? super IFloatValueBuilder> action)
Description copied from interface:IValueConfigurator
Execute the given action with this builder as a float value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenFloat
in interfaceIValueConfigurator
- Parameters:
action
- Action to execute if this builder is of the desired type.- Returns:
- getThis() builder instance to chain method calls.
-
whenInteger
default IValueBuilder<T> whenInteger(Consumer<? super IIntegerValueBuilder> action)
Description copied from interface:IValueConfigurator
Execute the given action with this builder as a integer value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenInteger
in interfaceIValueConfigurator
- Parameters:
action
- Action to execute if this builder is of the desired type.- Returns:
- getThis() builder instance to chain method calls.
-
whenList
default IValueBuilder<T> whenList(Consumer<? super IListValueBuilder<?>> action)
Description copied from interface:IValueConfigurator
Execute the given action with this builder as a list value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenList
in interfaceIValueConfigurator
- Parameters:
action
- Action to execute if this builder is of the desired type.- Returns:
- getThis() builder instance to chain method calls.
-
whenMap
default IValueBuilder<T> whenMap(Consumer<? super IMapValueBuilder<?>> action)
Description copied from interface:IValueConfigurator
Execute the given action with this builder as a map value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenMap
in interfaceIValueConfigurator
- Parameters:
action
- Action to execute if this builder is of the desired type.- Returns:
- getThis() builder instance to chain method calls.
-
whenNull
default IValueBuilder<T> whenNull(Consumer<? super INullValueBuilder> action)
Description copied from interface:IValueConfigurator
Execute the given action with this builder as a null value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenNull
in interfaceIValueConfigurator
- Parameters:
action
- Action to execute if this builder is of the desired type.- Returns:
- getThis() builder instance to chain method calls.
-
whenRecord
default IValueBuilder<T> whenRecord(Consumer<? super IRecordValueBuilder> action)
Description copied from interface:IValueConfigurator
Execute the given action with this builder as a record value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenRecord
in interfaceIValueConfigurator
- Parameters:
action
- Action to execute if this builder is of the desired type.- Returns:
- getThis() builder instance to chain method calls.
-
whenString
default IValueBuilder<T> whenString(Consumer<? super IStringValueBuilder> action)
Description copied from interface:IValueConfigurator
Execute the given action with this builder as a string value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenString
in interfaceIValueConfigurator
- Parameters:
action
- Action to execute if this builder is of the desired type.- Returns:
- getThis() builder instance to chain method calls.
-
whenTuple
default IValueBuilder<T> whenTuple(Consumer<? super ITupleValueBuilder> action)
Description copied from interface:IValueConfigurator
Execute the given action with this builder as a tuple value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenTuple
in interfaceIValueConfigurator
- Parameters:
action
- Action to execute if this builder is of the desired type.- Returns:
- getThis() builder instance to chain method calls.
-
whenUnion
default IValueBuilder<T> whenUnion(Consumer<? super IUnionValueBuilder<?>> action)
Description copied from interface:IValueConfigurator
Execute the given action with this builder as a union value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenUnion
in interfaceIValueConfigurator
- Parameters:
action
- Action to execute if this builder is of the desired type.- Returns:
- getThis() builder instance to chain method calls.
-
whenUnion
default <D> IValueConfigurator whenUnion(Class<D> discriminatorClass, Consumer<? super IUnionValueBuilder<D>> action)
Description copied from interface:IValueConfigurator
Execute the given action with this builder as a union value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenUnion
in interfaceIValueConfigurator
- Type Parameters:
D
- Type of the discriminating value.- Parameters:
discriminatorClass
- Type of the discriminating value.action
- Action to execute if this builder is of the desired type.- Returns:
- getThis() builder instance to chain method calls.
-
whenVoid
default IValueBuilder<T> whenVoid(Consumer<? super IVoidValueBuilder> action)
Description copied from interface:IValueConfigurator
Execute the given action with this builder as a void value builder, if this builder is of that type. Does nothing otherwise.- Specified by:
whenVoid
in interfaceIValueConfigurator
- Parameters:
action
- Action to execute if this builder is of the desired type.- Returns:
- getThis() builder instance to chain method calls.
-
asBoolean
default IBooleanValueBuilder asBoolean()
Description copied from interface:IValueConfigurator
Casts this builder to a boolean value builder.- Specified by:
asBoolean
in interfaceIValueConfigurator
- Returns:
- getThis() builder cast to a boolean value builder.
-
asConst
default IConstValueBuilder<?> asConst()
Description copied from interface:IValueConfigurator
Casts this builder to a constant value builder.- Specified by:
asConst
in interfaceIValueConfigurator
- Returns:
- getThis() builder cast to a constant value builder.
-
asFloat
default IFloatValueBuilder asFloat()
Description copied from interface:IValueConfigurator
Casts this builder to a floating point value builder.- Specified by:
asFloat
in interfaceIValueConfigurator
- Returns:
- getThis() builder cast to a floating point value builder.
-
asInteger
default IIntegerValueBuilder asInteger()
Description copied from interface:IValueConfigurator
Casts this builder to an integer value builder.- Specified by:
asInteger
in interfaceIValueConfigurator
- Returns:
- getThis() builder cast to an integer value builder.
-
asList
default <S> IListValueBuilder<S> asList()
Description copied from interface:IValueConfigurator
Casts this builder to a list value builder.- Specified by:
asList
in interfaceIValueConfigurator
- Returns:
- getThis() builder cast to a list value builder.
-
asMap
default <V> IMapValueBuilder<V> asMap()
Description copied from interface:IValueConfigurator
Casts this builder to a map value builder.- Specified by:
asMap
in interfaceIValueConfigurator
- Returns:
- getThis() builder cast to a map value builder.
-
asNull
default INullValueBuilder asNull()
Description copied from interface:IValueConfigurator
Casts this builder to a null value builder.- Specified by:
asNull
in interfaceIValueConfigurator
- Returns:
- getThis() builder cast to a null value builder.
-
asRecord
default IRecordValueBuilder asRecord()
Description copied from interface:IValueConfigurator
Casts this builder to a record value builder.- Specified by:
asRecord
in interfaceIValueConfigurator
- Returns:
- getThis() builder cast to a record value builder.
-
asString
default IStringValueBuilder asString()
Description copied from interface:IValueConfigurator
Casts this builder to a string value builder.- Specified by:
asString
in interfaceIValueConfigurator
- Returns:
- getThis() builder cast to a string value builder.
-
asTuple
default ITupleValueBuilder asTuple()
Description copied from interface:IValueConfigurator
Casts this builder to a tuple value builder.- Specified by:
asTuple
in interfaceIValueConfigurator
- Returns:
- getThis() builder cast to a tuple value builder.
-
asUnion
default IUnionValueBuilder<?> asUnion()
Description copied from interface:IValueConfigurator
Casts this builder to a union value builder.- Specified by:
asUnion
in interfaceIValueConfigurator
- Returns:
- getThis() builder cast to a union value builder.
-
asVoid
default IVoidValueBuilder asVoid()
Description copied from interface:IValueConfigurator
Casts this builder to a void value builder.- Specified by:
asVoid
in interfaceIValueConfigurator
- Returns:
- getThis() builder cast to a void value builder.
-
is
default boolean is(Class<? extends IValueBuilder> clazz)
- Specified by:
is
in interfaceIValueConfigurator
- Parameters:
clazz
- Class to check.- Returns:
- Whether this builder can be cast to the given class.
- See Also:
IValueConfigurator.unwrap(Class)
-
unwrap
default <TItem,TBuilder extends IValueBuilder<TItem>> TBuilder unwrap(Class<? extends TBuilder> clazz)
Description copied from interface:IValueConfigurator
Casts this builder to the given type. Make sure you are certain it is of the given type.- Specified by:
unwrap
in 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:
IValueConfigurator.is(Class)
-
value
IValueBuilder<T> value(Object value)
Description copied from interface:IValueConfigurator
Applies 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:
value
in interfaceIValueConfigurator
- Parameters:
value
- Sets the value created by this builder.- Returns:
- getThis() builder instance for chaining method calls.
-
-