Class FactoryBuilder


  • public class FactoryBuilder
    extends java.lang.Object
    Preconfigures and builds a Factory implementation.
    • Constructor Detail

      • FactoryBuilder

        public FactoryBuilder()
    • Method Detail

      • withWideningConversions

        public FactoryBuilder withWideningConversions()
        Enables the widening conversions that the Java language provides by default.
        Returns:
        the FactoryBuilder itself, for method chaining
      • withAutoBoxing

        public <S> FactoryBuilder withAutoBoxing()
        Enables the auto (un) boxing that the Java language provides by default.
        Type Parameters:
        S - used internally to make Javac happy
        Returns:
        the FactoryBuilder itself, for method chaining
      • withNarrowingConversions

        public FactoryBuilder withNarrowingConversions()
        Enables the narrowing conversions between primitives. Includes widening conversions.
        Returns:
        the FactoryBuilder itself, for method chaining
      • withArrayBoxing

        public FactoryBuilder withArrayBoxing()
        Enables autoboxing for linear arrays (e.g. byte[] and Byte[] become interchangeable)
        Returns:
        the FactoryBuilder itself, for method chaining
      • withBooleanIntConversions

        public FactoryBuilder withBooleanIntConversions()
        Enables converting booleans to integers.
        Returns:
        the FactoryBuilder itself, for method chaining
      • withAutomaticToString

        public FactoryBuilder withAutomaticToString()
        Automatically converts objects to String when needed, by means of Object.toString().
        Returns:
        the FactoryBuilder itself, for method chaining
      • withArrayWideningConversions

        public FactoryBuilder withArrayWideningConversions()
        Enables widening conversions for linear arrays (e.g. int[] can get converted to long[]). Includes array autoboxing.
        Returns:
        the FactoryBuilder itself, for method chaining
      • withArrayNarrowingConversions

        public FactoryBuilder withArrayNarrowingConversions()
        Enables narrowing conversions for linear arrays (e.g. double[] can get converted to int[]). Includes widening conversions.
        Returns:
        the FactoryBuilder itself, for method chaining
      • withArrayBooleanIntConversions

        public FactoryBuilder withArrayBooleanIntConversions()
        Enables converting linear arrays of booleans to linear arrays of integers. Includes array boxing.
        Returns:
        the FactoryBuilder itself, for method chaining
      • withArrayListConversions

        public FactoryBuilder withArrayListConversions​(java.lang.Class<?>... classes)
        Enables converting linear arrays to lists for the provided classes and Object. Includes array autoboxing.
        Parameters:
        classes - the target classes
        Returns:
        the FactoryBuilder itself, for method chaining
      • build

        public Factory build()
        Returns:
        the configured factory. Must be called exactly once.