Interface IValueBuilder<T>
- Type Parameters:
T
- Type of the value created by this builder.
- All Superinterfaces:
org.apache.commons.lang3.builder.Builder<T>
- All Known Subinterfaces:
IAnyValueBuilder
,IBooleanValueBuilder
,IConstValueBuilder<V>
,IFloatValueBuilder
,IIntegerValueBuilder
,ILargeStringValueBuilder
,IListValueBuilder<V>
,IMapValueBuilder<V>
,INullValueBuilder
,IRecordValueBuilder
,IStringValueBuilder
,ITupleValueBuilder
,IUnionValueBuilder<D>
,IVoidValueBuilder
public interface IValueBuilder<T>
extends 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 IBooleanValueBuilder
Casts this builder to a boolean value builder.default <S> IConstValueBuilder<S>
asConst()
Casts this builder to a constant value builder.default IFloatValueBuilder
asFloat()
Casts this builder to a floating point value builder.default IIntegerValueBuilder
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 <D> IUnionValueBuilder<D>
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>>
TBuilderCasts this builder to the given type.Applies the given value to this builder.Methods inherited from interface org.apache.commons.lang3.builder.Builder
build
-
Method Details
-
asBoolean
Casts this builder to a boolean value builder.- Returns:
- This 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.- Type Parameters:
S
- Type of the constant value.- Returns:
- This 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:
- This 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:
- This 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:
- This 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:
- This 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:
- This 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:
- This 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:
- This 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:
- This 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.- Type Parameters:
D
- Type of then union discriminator.- Returns:
- This 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:
- This 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:
- This 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:
- This builder instance for chaining method calls.
-