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 TypeMethodDescriptionbuild()
Build the instance from the current state.Build the instance from the current state and given parameters to the build method.convert
(int index, @NonNull ArgumentConversionContext<A> argument, @Nullable Object value, @NonNull ConversionService conversionService) Create the instance with the given value for the given property.All the arguments possible for creating the instance.Any arguments required by the build method.int
Create the instance with the given value for the given property.Create the instance with the given value for the given property.Create the instance copying properties from the given instance to start.
-
Method Details
-
getBuilderArguments
All the arguments possible for creating the instance.- Returns:
- The arguments
-
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
@NonNull @NonNull BeanIntrospection.Builder<T> with(@NonNull @NonNull String name, @Nullable @Nullable Object value) 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
@NonNull <A> @NonNull BeanIntrospection.Builder<T> with(int index, @NonNull @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
@NonNull <A> @NonNull BeanIntrospection.Builder<T> convert(int index, @NonNull @NonNull ArgumentConversionContext<A> argument, @Nullable @Nullable Object value, @NonNull @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
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
-