Package io.micronaut.core.beans
Interface BeanIntrospection.Builder<T>
- Type Parameters:
T- The bean type.
- Enclosing interface:
BeanIntrospection<T>
public static interface BeanIntrospection.Builder<T>
A builder style API for creating instances that abstracts whether the instance is a record, bean or created by another builder.
- Since:
- 4.1.0
-
Method Summary
Modifier and TypeMethodDescription@NonNull Tbuild()Build the instance from the current state.@NonNull TBuild the instance from the current state and given parameters to the build method.<A> @NonNull BeanIntrospection.Builder<T> convert(int index, @NonNull ArgumentConversionContext<A> argument, @Nullable Object value, @NonNull ConversionService conversionService) Create the instance with the given value for the given property.@NonNull Argument<?>[]All the arguments possible for creating the instance.@NonNull Argument<?>[]Any arguments required by the build method.int<A> @NonNull BeanIntrospection.Builder<T> Create the instance with the given value for the given property.@NonNull BeanIntrospection.Builder<T> Create the instance with the given value for the given property.@NonNull BeanIntrospection.Builder<T> Create the instance copying properties from the given instance to start.
-
Method Details
-
getBuilderArguments
@NonNull Argument<?>[] getBuilderArguments()All the arguments possible for creating the instance.- Returns:
- The arguments
-
getBuildMethodArguments
@NonNull Argument<?>[] getBuildMethodArguments()Any arguments required by the build method. If the build method has arguments these should be provided bybuild().- Returns:
- The arguments
-
indexOf
- Parameters:
name- The argument name- Returns:
- The index.
-
with
Create the instance with the given value for the given property.- Parameters:
name- The name of the argumentvalue- The value- Returns:
- This builder
-
with
Create the instance copying properties from the given instance to start.- Parameters:
existing- The existing bean- Returns:
- This builder
-
with
<A> @NonNull BeanIntrospection.Builder<T> with(int index, @NonNull Argument<A> argument, @Nullable A value) Create the instance with the given value for the given property.- Type Parameters:
A- The generic type- Parameters:
index- The index of the argumentargument- The argumentvalue- The value- Returns:
- This builder
-
convert
<A> @NonNull BeanIntrospection.Builder<T> convert(int index, @NonNull ArgumentConversionContext<A> argument, @Nullable Object value, @NonNull ConversionService conversionService) Create the instance with the given value for the given property.- Type Parameters:
A- The generic type- Parameters:
index- The index of the argumentargument- The argumentvalue- The valueconversionService- The conversion service- Returns:
- This builder
-
build
@NonNull T build()Build the instance from the current state.- Returns:
- The built instance.
- Throws:
IllegalArgumentException- If one of the supplied inputs is invalid
-
build
Build the instance from the current state and given parameters to the build method.- Parameters:
params- The params- Returns:
- The built instance.
- Throws:
IllegalArgumentException- If one of the supplied inputs is invalid
-