Class BeanBuilder<T>

java.lang.Object
org.apache.juneau.BeanBuilder<T>
Type Parameters:
T - The bean type that the builder creates.
Direct Known Subclasses:
CallLoggerRule.Builder, EncoderSet.Builder, FileFinder.Builder, Messages.Builder, MethodExecStats.Builder, MethodExecStore.Builder, ParserSet.Builder, ResponseProcessorList.Builder, RestChildren.Builder, RestConverterList.Builder, RestGuardList.Builder, RestMatcherList.Builder, RestOpArgList.Builder, RestOperations.Builder, SerializerSet.Builder, StaticFiles.Builder, ThrownStore.Builder, VarResolver.Builder

public class BeanBuilder<T> extends Object
Base class for bean builders.
See Also:
  • Constructor Details

    • BeanBuilder

      protected BeanBuilder(Class<? extends T> defaultType, BeanStore beanStore)
      Constructor.
      Parameters:
      beanStore - The bean store to use for creating beans.
      defaultType - The default bean type that this builder creates.
    • BeanBuilder

      protected BeanBuilder(Class<? extends T> defaultType)
      Constructor.
      Parameters:
      defaultType - The type of bean being created.
    • BeanBuilder

      protected BeanBuilder(BeanBuilder<T> copyFrom)
      Copy constructor.
      Parameters:
      copyFrom - The bean store to copy from.
  • Method Details

    • build

      public T build()
      Creates the bean.
      Returns:
      A new bean.
    • creator

      protected BeanCreator<? extends T> creator()
      Instantiates the creator for this bean.

      Subclasses can override this to provide specialized handling.

      Returns:
      The creator for this bean.
    • buildDefault

      protected T buildDefault()
      Creates the bean when the bean type is null or is the default value.
      Returns:
      A new bean.
    • type

      public BeanBuilder<T> type(Class<?> value)
      Overrides the bean type produced by the build() method.

      Use this method if you want to instantiated a bean subclass.

      Parameters:
      value - The setting value.
      Returns:
      This object.
    • type

      protected Optional<Class<? extends T>> type()
      Returns the implementation type specified via type(Class).
      Returns:
      The implementation type specified via type(Class).
    • impl

      public BeanBuilder<T> impl(Object value)
      Overrides the bean returned by the build() method.

      Use this method if you want this builder to return an already-instantiated bean.

      Parameters:
      value - The setting value.
      Returns:
      This object.
    • impl

      protected Optional<T> impl()
      Returns the override bean specified via impl(Object).
      Returns:
      The override bean specified via impl(Object).
    • beanStore

      public BeanStore beanStore()
      Returns the bean store passed in through the constructor.
      Returns:
      The bean store passed in through the constructor.