Package org.danilopianini.jirf
Class FactoryBuilder
- java.lang.Object
-
- org.danilopianini.jirf.FactoryBuilder
-
public class FactoryBuilder extends java.lang.Object
Preconfigures and builds aFactory
implementation.
-
-
Constructor Summary
Constructors Constructor Description FactoryBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Factory
build()
FactoryBuilder
withArrayBooleanIntConversions()
Enables converting linear arrays of booleans to linear arrays of integers.FactoryBuilder
withArrayBoxing()
Enables autoboxing for linear arrays (e.g.FactoryBuilder
withArrayListConversions(java.lang.Class<?>... classes)
Enables converting linear arrays to lists for the provided classes and Object.FactoryBuilder
withArrayNarrowingConversions()
Enables narrowing conversions for linear arrays (e.g.FactoryBuilder
withArrayWideningConversions()
Enables widening conversions for linear arrays (e.g.<S> FactoryBuilder
withAutoBoxing()
Enables the auto (un) boxing that the Java language provides by default.FactoryBuilder
withAutomaticToString()
Automatically converts objects toString
when needed, by means ofObject.toString()
.FactoryBuilder
withBooleanIntConversions()
Enables converting booleans to integers.FactoryBuilder
withNarrowingConversions()
Enables the narrowing conversions between primitives.FactoryBuilder
withWideningConversions()
Enables the widening conversions that the Java language provides by default.
-
-
-
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 toString
when needed, by means ofObject.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.
-
-