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 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 by build().
      Returns:
      The arguments
    • indexOf

      int indexOf(String name)
      Parameters:
      name - The argument name
      Returns:
      The index.
    • with

      @NonNull BeanIntrospection.Builder<T> with(@NonNull String name, @Nullable Object value)
      Create the instance with the given value for the given property.
      Parameters:
      name - The name of the argument
      value - The value
      Returns:
      This builder
    • with

      @NonNull BeanIntrospection.Builder<T> with(T existing)
      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 argument
      argument - The argument
      value - 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 argument
      argument - The argument
      value - The value
      conversionService - 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

      @NonNull T build(Object... params)
      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