Interface IValueConfigurator
- All Known Subinterfaces:
IAnyValueBuilder, IBooleanValueBuilder, IConstValueBuilder<V>, IFloatValueBuilder, IIntegerValueBuilder, ILargeStringValueBuilder, IListValueBuilder<V>, IMapValueBuilder<V>, INullValueBuilder, IRecordValueBuilder, IStringValueBuilder, ISubTypeValueBuilder<T,Builder>, ITupleValueBuilder, IUnionValueBuilder, IValueBuilder<T>, IVoidValueBuilder
public interface IValueConfigurator
Base interface for builders that can configure 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:
- 8.2.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 IValueConfiguratorwhenBoolean(Consumer<? super IBooleanValueBuilder> action) Execute the given action with this builder as a boolean value builder, if this builder is of that type.default IValueConfiguratorwhenConst(Consumer<? super IConstValueBuilder<?>> action) Execute the given action with this builder as a const value builder, if this builder is of that type.default IValueConfiguratorwhenFloat(Consumer<? super IFloatValueBuilder> action) Execute the given action with this builder as a float value builder, if this builder is of that type.default IValueConfiguratorwhenInteger(Consumer<? super IIntegerValueBuilder> action) Execute the given action with this builder as an integer value builder, if this builder is of that type.default IValueConfiguratorwhenList(Consumer<? super IListValueBuilder<?>> action) Execute the given action with this builder as a list value builder, if this builder is of that type.default IValueConfiguratorwhenMap(Consumer<? super IMapValueBuilder<?>> action) Execute the given action with this builder as a map value builder, if this builder is of that type.default IValueConfiguratorwhenNull(Consumer<? super INullValueBuilder> action) Execute the given action with this builder as a null value builder, if this builder is of that type.default IValueConfiguratorwhenRecord(Consumer<? super IRecordValueBuilder> action) Execute the given action with this builder as a record value builder, if this builder is of that type.default IValueConfiguratorwhenString(Consumer<? super IStringValueBuilder> action) Execute the given action with this builder as a string value builder, if this builder is of that type.default IValueConfiguratorwhenTuple(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<?> ignoredDiscriminatorClass, Consumer<? super IUnionValueBuilder> action) Deprecated.default IValueConfiguratorwhenUnion(Consumer<? super IUnionValueBuilder> action) Execute the given action with this builder as a union value builder, if this builder is of that type.default IValueConfiguratorwhenVoid(Consumer<? super IVoidValueBuilder> action) Execute the given action with this builder as a void value builder, if this builder is of that type.
-
Method Details
-
asBoolean
Casts this builder to a boolean value builder.- Returns:
- getThis() builder cast to a boolean value builder.
- Throws:
ClassCastException- When this builder cannot be cast to the desired type.
-
asConst
Casts this builder to a constant value builder.- Returns:
- getThis() builder cast to a constant value builder.
- Throws:
ClassCastException- When this builder cannot be cast to the desired type.
-
asFloat
Casts this builder to a floating point value builder.- Returns:
- getThis() builder cast to a floating point value builder.
- Throws:
ClassCastException- When this builder cannot be cast to the desired type.
-
asInteger
Casts this builder to an integer value builder.- Returns:
- getThis() builder cast to an integer value builder.
- Throws:
ClassCastException- When this builder cannot be cast to the desired type.
-
asList
Casts this builder to a list value builder.- Returns:
- getThis() builder cast to a list value builder.
- Throws:
ClassCastException- When this builder cannot be cast to the desired type.
-
asMap
Casts this builder to a map value builder.- Returns:
- getThis() builder cast to a map value builder.
- Throws:
ClassCastException- When this builder cannot be cast to the desired type.
-
asNull
Casts this builder to a null value builder.- Returns:
- getThis() builder cast to a null value builder.
- Throws:
ClassCastException- When this builder cannot be cast to the desired type.
-
asRecord
Casts this builder to a record value builder.- Returns:
- getThis() builder cast to a record value builder.
- Throws:
ClassCastException- When this builder cannot be cast to the desired type.
-
asString
Casts this builder to a string value builder.- Returns:
- getThis() builder cast to a string value builder.
- Throws:
ClassCastException- When this builder cannot be cast to the desired type.
-
asTuple
Casts this builder to a tuple value builder.- Returns:
- getThis() builder cast to a tuple value builder.
- Throws:
ClassCastException- When this builder cannot be cast to the desired type.
-
asUnion
Casts this builder to a union value builder.- Returns:
- getThis() builder cast to a union value builder.
- Throws:
ClassCastException- When this builder cannot be cast to the desired type.
-
asVoid
Casts this builder to a void value builder.- Returns:
- getThis() builder cast to a void value builder.
- Throws:
ClassCastException- When this builder cannot be cast to the desired type.
-
is
- 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) Casts this builder to the given type. Make sure you are certain it is of the given type.- 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.
- Throws:
ClassCastException- When this descriptor cannot be cast to the given type.- See Also:
-
value
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.- Parameters:
value- Sets the value created by this builder.- Returns:
- getThis() builder instance for chaining method calls.
-
whenBoolean
@CanIgnoreReturnValue default IValueConfigurator whenBoolean(Consumer<? super IBooleanValueBuilder> action) Execute the given action with this builder as a boolean value builder, if this builder is of that type. Does nothing otherwise.- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenConst
@CanIgnoreReturnValue default IValueConfigurator whenConst(Consumer<? super IConstValueBuilder<?>> action) Execute the given action with this builder as a const value builder, if this builder is of that type. Does nothing otherwise.- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenFloat
@CanIgnoreReturnValue default IValueConfigurator whenFloat(Consumer<? super IFloatValueBuilder> action) Execute the given action with this builder as a float value builder, if this builder is of that type. Does nothing otherwise.- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenInteger
@CanIgnoreReturnValue default IValueConfigurator whenInteger(Consumer<? super IIntegerValueBuilder> action) Execute the given action with this builder as an integer value builder, if this builder is of that type. Does nothing otherwise.- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenList
@CanIgnoreReturnValue default IValueConfigurator whenList(Consumer<? super IListValueBuilder<?>> action) Execute the given action with this builder as a list value builder, if this builder is of that type. Does nothing otherwise.- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenMap
@CanIgnoreReturnValue default IValueConfigurator whenMap(Consumer<? super IMapValueBuilder<?>> action) Execute the given action with this builder as a map value builder, if this builder is of that type. Does nothing otherwise.- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenNull
@CanIgnoreReturnValue default IValueConfigurator whenNull(Consumer<? super INullValueBuilder> action) Execute the given action with this builder as a null value builder, if this builder is of that type. Does nothing otherwise.- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenRecord
@CanIgnoreReturnValue default IValueConfigurator whenRecord(Consumer<? super IRecordValueBuilder> action) Execute the given action with this builder as a record value builder, if this builder is of that type. Does nothing otherwise.- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenString
@CanIgnoreReturnValue default IValueConfigurator whenString(Consumer<? super IStringValueBuilder> action) Execute the given action with this builder as a string value builder, if this builder is of that type. Does nothing otherwise.- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenTuple
@CanIgnoreReturnValue default IValueConfigurator whenTuple(Consumer<? super ITupleValueBuilder> action) Execute the given action with this builder as a tuple value builder, if this builder is of that type. Does nothing otherwise.- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenUnion
@CanIgnoreReturnValue default IValueConfigurator whenUnion(Consumer<? super IUnionValueBuilder> action) Execute the given action with this builder as a union value builder, if this builder is of that type. Does nothing otherwise.- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenUnion
@Deprecated @CanIgnoreReturnValue default IValueConfigurator whenUnion(Class<?> ignoredDiscriminatorClass, Consumer<? super IUnionValueBuilder> action) Deprecated.UsewhenUnion(Consumer)instead. There is no discriminator anymore.Execute the given action with this builder as a union value builder, if this builder is of that type. Does nothing otherwise.- Parameters:
ignoredDiscriminatorClass- Unusedaction- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenVoid
@CanIgnoreReturnValue default IValueConfigurator whenVoid(Consumer<? super IVoidValueBuilder> action) Execute the given action with this builder as a void value builder, if this builder is of that type. Does nothing otherwise.- Parameters:
action- Action to execute if this builder is of the desired type.- Returns:
- This builder instance to chain method calls.
-
whenUnion(Consumer)instead.