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

      Argument<?>[] getBuilderArguments()
      All the arguments possible for creating the instance.
      Returns:
      The arguments
    • getBuildMethodArguments

      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

      BeanIntrospection.Builder<T> with(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

      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> BeanIntrospection.Builder<T> with(int index, 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> BeanIntrospection.Builder<T> convert(int index, ArgumentConversionContext<A> argument, @Nullable Object value, 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

      T build()
      Build the instance from the current state.
      Returns:
      The built instance.
      Throws:
      IllegalArgumentException - If one of the supplied inputs is invalid
    • build

      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