Class BuildableType_Builder
- java.lang.Object
-
- org.inferred.freebuilder.processor.BuildableType_Builder
-
- Direct Known Subclasses:
BuildableType.Builder
@Generated("org.inferred.freebuilder.processor.Processor") abstract class BuildableType_Builder extends java.lang.ObjectAuto-generated superclass ofBuildableType.Builder, derived from the API ofBuildableType.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classBuildableType_Builder.Partialprivate static classBuildableType_Builder.Propertyprivate static classBuildableType_Builder.Rebuildableprivate static classBuildableType_Builder.Value
-
Field Summary
Fields Modifier and Type Field Description private java.util.EnumSet<BuildableType_Builder.Property>_unsetPropertiesprivate BuilderFactorybuilderFactoryprivate TypebuilderTypeprivate BuildableType.MergeBuilderMethodmergeBuilderprivate BuildableType.PartialToBuilderMethodpartialToBuilderprivate ExcerptsuppressUncheckedprivate Typetype
-
Constructor Summary
Constructors Constructor Description BuildableType_Builder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BuildableTypebuild()Returns a newly-createdBuildableTypebased on the contents of thisBuilder.BuilderFactorybuilderFactory()Returns the value that will be returned byBuildableType.builderFactory().BuildableType.BuilderbuilderFactory(BuilderFactory builderFactory)Sets the value to be returned byBuildableType.builderFactory().TypebuilderType()Returns the value that will be returned byBuildableType.builderType().BuildableType.BuilderbuilderType(Type builderType)Sets the value to be returned byBuildableType.builderType().BuildableTypebuildPartial()Returns a newly-created partialBuildableTypefor use in unit tests.BuildableType.Builderclear()Resets the state of this builder.static BuildableType.Builderfrom(BuildableType value)Creates a new builder usingvalueas a template.BuildableType.BuildermapBuilderFactory(java.util.function.UnaryOperator<BuilderFactory> mapper)Replaces the value to be returned byBuildableType.builderFactory()by applyingmapperto it and using the result.BuildableType.BuildermapBuilderType(java.util.function.UnaryOperator<Type> mapper)Replaces the value to be returned byBuildableType.builderType()by applyingmapperto it and using the result.BuildableType.BuildermapMergeBuilder(java.util.function.UnaryOperator<BuildableType.MergeBuilderMethod> mapper)Replaces the value to be returned byBuildableType.mergeBuilder()by applyingmapperto it and using the result.BuildableType.BuildermapPartialToBuilder(java.util.function.UnaryOperator<BuildableType.PartialToBuilderMethod> mapper)Replaces the value to be returned byBuildableType.partialToBuilder()by applyingmapperto it and using the result.BuildableType.BuildermapSuppressUnchecked(java.util.function.UnaryOperator<Excerpt> mapper)Replaces the value to be returned byBuildableType.suppressUnchecked()by applyingmapperto it and using the result.BuildableType.BuildermapType(java.util.function.UnaryOperator<Type> mapper)Replaces the value to be returned byBuildableType.type()by applyingmapperto it and using the result.BuildableType.MergeBuilderMethodmergeBuilder()Returns the value that will be returned byBuildableType.mergeBuilder().BuildableType.BuildermergeBuilder(BuildableType.MergeBuilderMethod mergeBuilder)Sets the value to be returned byBuildableType.mergeBuilder().BuildableType.BuildermergeFrom(BuildableType value)Copies values fromvalue.BuildableType.BuildermergeFrom(BuildableType.Builder template)Copies values fromtemplate, skipping unset properties.BuildableType.PartialToBuilderMethodpartialToBuilder()Returns the value that will be returned byBuildableType.partialToBuilder().BuildableType.BuilderpartialToBuilder(BuildableType.PartialToBuilderMethod partialToBuilder)Sets the value to be returned byBuildableType.partialToBuilder().ExcerptsuppressUnchecked()Returns the value that will be returned byBuildableType.suppressUnchecked().BuildableType.BuildersuppressUnchecked(Excerpt suppressUnchecked)Sets the value to be returned byBuildableType.suppressUnchecked().Typetype()Returns the value that will be returned byBuildableType.type().BuildableType.Buildertype(Type type)Sets the value to be returned byBuildableType.type().
-
-
-
Field Detail
-
type
private Type type
-
builderType
private Type builderType
-
mergeBuilder
private BuildableType.MergeBuilderMethod mergeBuilder
-
partialToBuilder
private BuildableType.PartialToBuilderMethod partialToBuilder
-
builderFactory
private BuilderFactory builderFactory
-
suppressUnchecked
private Excerpt suppressUnchecked
-
_unsetProperties
private final java.util.EnumSet<BuildableType_Builder.Property> _unsetProperties
-
-
Method Detail
-
from
public static BuildableType.Builder from(BuildableType value)
Creates a new builder usingvalueas a template.If
valueis a partial, the builder will return more partials.
-
type
public BuildableType.Builder type(Type type)
Sets the value to be returned byBuildableType.type().- Returns:
- this
Builderobject - Throws:
java.lang.NullPointerException- iftypeis null
-
mapType
public BuildableType.Builder mapType(java.util.function.UnaryOperator<Type> mapper)
Replaces the value to be returned byBuildableType.type()by applyingmapperto it and using the result.- Returns:
- this
Builderobject - Throws:
java.lang.NullPointerException- ifmapperis null or returns nulljava.lang.IllegalStateException- if the field has not been set
-
type
public Type type()
Returns the value that will be returned byBuildableType.type().- Throws:
java.lang.IllegalStateException- if the field has not been set
-
builderType
public BuildableType.Builder builderType(Type builderType)
Sets the value to be returned byBuildableType.builderType().- Returns:
- this
Builderobject - Throws:
java.lang.NullPointerException- ifbuilderTypeis null
-
mapBuilderType
public BuildableType.Builder mapBuilderType(java.util.function.UnaryOperator<Type> mapper)
Replaces the value to be returned byBuildableType.builderType()by applyingmapperto it and using the result.- Returns:
- this
Builderobject - Throws:
java.lang.NullPointerException- ifmapperis null or returns nulljava.lang.IllegalStateException- if the field has not been set
-
builderType
public Type builderType()
Returns the value that will be returned byBuildableType.builderType().- Throws:
java.lang.IllegalStateException- if the field has not been set
-
mergeBuilder
public BuildableType.Builder mergeBuilder(BuildableType.MergeBuilderMethod mergeBuilder)
Sets the value to be returned byBuildableType.mergeBuilder().- Returns:
- this
Builderobject - Throws:
java.lang.NullPointerException- ifmergeBuilderis null
-
mapMergeBuilder
public BuildableType.Builder mapMergeBuilder(java.util.function.UnaryOperator<BuildableType.MergeBuilderMethod> mapper)
Replaces the value to be returned byBuildableType.mergeBuilder()by applyingmapperto it and using the result.- Returns:
- this
Builderobject - Throws:
java.lang.NullPointerException- ifmapperis null or returns nulljava.lang.IllegalStateException- if the field has not been set
-
mergeBuilder
public BuildableType.MergeBuilderMethod mergeBuilder()
Returns the value that will be returned byBuildableType.mergeBuilder().- Throws:
java.lang.IllegalStateException- if the field has not been set
-
partialToBuilder
public BuildableType.Builder partialToBuilder(BuildableType.PartialToBuilderMethod partialToBuilder)
Sets the value to be returned byBuildableType.partialToBuilder().- Returns:
- this
Builderobject - Throws:
java.lang.NullPointerException- ifpartialToBuilderis null
-
mapPartialToBuilder
public BuildableType.Builder mapPartialToBuilder(java.util.function.UnaryOperator<BuildableType.PartialToBuilderMethod> mapper)
Replaces the value to be returned byBuildableType.partialToBuilder()by applyingmapperto it and using the result.- Returns:
- this
Builderobject - Throws:
java.lang.NullPointerException- ifmapperis null or returns nulljava.lang.IllegalStateException- if the field has not been set
-
partialToBuilder
public BuildableType.PartialToBuilderMethod partialToBuilder()
Returns the value that will be returned byBuildableType.partialToBuilder().- Throws:
java.lang.IllegalStateException- if the field has not been set
-
builderFactory
public BuildableType.Builder builderFactory(BuilderFactory builderFactory)
Sets the value to be returned byBuildableType.builderFactory().- Returns:
- this
Builderobject - Throws:
java.lang.NullPointerException- ifbuilderFactoryis null
-
mapBuilderFactory
public BuildableType.Builder mapBuilderFactory(java.util.function.UnaryOperator<BuilderFactory> mapper)
Replaces the value to be returned byBuildableType.builderFactory()by applyingmapperto it and using the result.- Returns:
- this
Builderobject - Throws:
java.lang.NullPointerException- ifmapperis null or returns nulljava.lang.IllegalStateException- if the field has not been set
-
builderFactory
public BuilderFactory builderFactory()
Returns the value that will be returned byBuildableType.builderFactory().- Throws:
java.lang.IllegalStateException- if the field has not been set
-
suppressUnchecked
public BuildableType.Builder suppressUnchecked(Excerpt suppressUnchecked)
Sets the value to be returned byBuildableType.suppressUnchecked().- Returns:
- this
Builderobject - Throws:
java.lang.NullPointerException- ifsuppressUncheckedis null
-
mapSuppressUnchecked
public BuildableType.Builder mapSuppressUnchecked(java.util.function.UnaryOperator<Excerpt> mapper)
Replaces the value to be returned byBuildableType.suppressUnchecked()by applyingmapperto it and using the result.- Returns:
- this
Builderobject - Throws:
java.lang.NullPointerException- ifmapperis null or returns nulljava.lang.IllegalStateException- if the field has not been set
-
suppressUnchecked
public Excerpt suppressUnchecked()
Returns the value that will be returned byBuildableType.suppressUnchecked().- Throws:
java.lang.IllegalStateException- if the field has not been set
-
mergeFrom
public BuildableType.Builder mergeFrom(BuildableType value)
Copies values fromvalue.- Returns:
- this
Builderobject
-
mergeFrom
public BuildableType.Builder mergeFrom(BuildableType.Builder template)
Copies values fromtemplate, skipping unset properties.- Returns:
- this
Builderobject
-
clear
public BuildableType.Builder clear()
Resets the state of this builder.- Returns:
- this
Builderobject
-
build
public BuildableType build()
Returns a newly-createdBuildableTypebased on the contents of thisBuilder.- Throws:
java.lang.IllegalStateException- if any field has not been set
-
buildPartial
public BuildableType buildPartial()
Returns a newly-created partialBuildableTypefor use in unit tests. State checking will not be performed. Unset properties will throw anUnsupportedOperationExceptionwhen accessed via the partial object.The builder returned by
from(BuildableType)will propagate the partial status of its input, overridingbuild()to return another partial. This allows for robust tests of modify-rebuild code.Partials should only ever be used in tests. They permit writing robust test cases that won't fail if this type gains more application-level constraints (e.g. new required fields) in future. If you require partially complete values in production code, consider using a Builder.
-
-