Class TypeUsage_Builder
- java.lang.Object
-
- org.inferred.freebuilder.processor.source.TypeUsage_Builder
-
- Direct Known Subclasses:
TypeUsage.Builder
@Generated("org.inferred.freebuilder.processor.Processor") abstract class TypeUsage_Builder extends java.lang.ObjectAuto-generated superclass ofTypeUsage.Builder, derived from the API ofTypeUsage.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classTypeUsage_Builder.Partialprivate static classTypeUsage_Builder.Propertyprivate static classTypeUsage_Builder.Rebuildableprivate static classTypeUsage_Builder.Value
-
Field Summary
Fields Modifier and Type Field Description private java.util.EnumSet<TypeUsage_Builder.Property>_unsetPropertiesprivate intendprivate QualifiedNamescopeprivate intstartprivate QualifiedNametype
-
Constructor Summary
Constructors Constructor Description TypeUsage_Builder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TypeUsagebuild()Returns a newly-createdTypeUsagebased on the contents of thisBuilder.TypeUsagebuildPartial()Returns a newly-created partialTypeUsagefor use in unit tests.TypeUsage.Builderclear()Resets the state of this builder.TypeUsage.BuilderclearScope()Sets the value to be returned byTypeUsage.scope()toOptional.empty().intend()Returns the value that will be returned byTypeUsage.end().TypeUsage.Builderend(int end)Sets the value to be returned byTypeUsage.end().static TypeUsage.Builderfrom(TypeUsage value)Creates a new builder usingvalueas a template.TypeUsage.BuildermapEnd(java.util.function.IntUnaryOperator mapper)Replaces the value to be returned byTypeUsage.end()by applyingmapperto it and using the result.TypeUsage.BuildermapScope(java.util.function.UnaryOperator<QualifiedName> mapper)If the value to be returned byTypeUsage.scope()is present, replaces it by applyingmapperto it and using the result.TypeUsage.BuildermapStart(java.util.function.IntUnaryOperator mapper)Replaces the value to be returned byTypeUsage.start()by applyingmapperto it and using the result.TypeUsage.BuildermapType(java.util.function.UnaryOperator<QualifiedName> mapper)Replaces the value to be returned byTypeUsage.type()by applyingmapperto it and using the result.TypeUsage.BuildermergeFrom(TypeUsage value)Copies values fromvalue, skipping empty optionals.TypeUsage.BuildermergeFrom(TypeUsage.Builder template)Copies values fromtemplate, skipping empty optionals and unset properties.TypeUsage.BuildernullableScope(QualifiedName scope)Sets the value to be returned byTypeUsage.scope().java.util.Optional<QualifiedName>scope()Returns the value that will be returned byTypeUsage.scope().TypeUsage.Builderscope(java.util.Optional<? extends QualifiedName> scope)Sets the value to be returned byTypeUsage.scope().TypeUsage.Builderscope(QualifiedName scope)Sets the value to be returned byTypeUsage.scope().intstart()Returns the value that will be returned byTypeUsage.start().TypeUsage.Builderstart(int start)Sets the value to be returned byTypeUsage.start().QualifiedNametype()Returns the value that will be returned byTypeUsage.type().TypeUsage.Buildertype(QualifiedName type)Sets the value to be returned byTypeUsage.type().
-
-
-
Field Detail
-
start
private int start
-
end
private int end
-
type
private QualifiedName type
-
scope
private QualifiedName scope
-
_unsetProperties
private final java.util.EnumSet<TypeUsage_Builder.Property> _unsetProperties
-
-
Method Detail
-
from
public static TypeUsage.Builder from(TypeUsage value)
Creates a new builder usingvalueas a template.If
valueis a partial, the builder will return more partials.
-
start
public TypeUsage.Builder start(int start)
Sets the value to be returned byTypeUsage.start().- Returns:
- this
Builderobject
-
mapStart
public TypeUsage.Builder mapStart(java.util.function.IntUnaryOperator mapper)
Replaces the value to be returned byTypeUsage.start()by applyingmapperto it and using the result.- Returns:
- this
Builderobject - Throws:
java.lang.NullPointerException- ifmapperis nulljava.lang.IllegalStateException- if the field has not been set
-
start
public int start()
Returns the value that will be returned byTypeUsage.start().- Throws:
java.lang.IllegalStateException- if the field has not been set
-
end
public TypeUsage.Builder end(int end)
Sets the value to be returned byTypeUsage.end().- Returns:
- this
Builderobject
-
mapEnd
public TypeUsage.Builder mapEnd(java.util.function.IntUnaryOperator mapper)
Replaces the value to be returned byTypeUsage.end()by applyingmapperto it and using the result.- Returns:
- this
Builderobject - Throws:
java.lang.NullPointerException- ifmapperis nulljava.lang.IllegalStateException- if the field has not been set
-
end
public int end()
Returns the value that will be returned byTypeUsage.end().- Throws:
java.lang.IllegalStateException- if the field has not been set
-
type
public TypeUsage.Builder type(QualifiedName type)
Sets the value to be returned byTypeUsage.type().- Returns:
- this
Builderobject - Throws:
java.lang.NullPointerException- iftypeis null
-
mapType
public TypeUsage.Builder mapType(java.util.function.UnaryOperator<QualifiedName> mapper)
Replaces the value to be returned byTypeUsage.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 QualifiedName type()
Returns the value that will be returned byTypeUsage.type().- Throws:
java.lang.IllegalStateException- if the field has not been set
-
scope
public TypeUsage.Builder scope(QualifiedName scope)
Sets the value to be returned byTypeUsage.scope().- Returns:
- this
Builderobject - Throws:
java.lang.NullPointerException- ifscopeis null
-
scope
public TypeUsage.Builder scope(java.util.Optional<? extends QualifiedName> scope)
Sets the value to be returned byTypeUsage.scope().- Returns:
- this
Builderobject
-
nullableScope
public TypeUsage.Builder nullableScope(QualifiedName scope)
Sets the value to be returned byTypeUsage.scope().- Returns:
- this
Builderobject
-
mapScope
public TypeUsage.Builder mapScope(java.util.function.UnaryOperator<QualifiedName> mapper)
If the value to be returned byTypeUsage.scope()is present, replaces it by applyingmapperto it and using the result.If the result is null, clears the value.
- Returns:
- this
Builderobject - Throws:
java.lang.NullPointerException- ifmapperis null
-
clearScope
public TypeUsage.Builder clearScope()
Sets the value to be returned byTypeUsage.scope()toOptional.empty().- Returns:
- this
Builderobject
-
scope
public java.util.Optional<QualifiedName> scope()
Returns the value that will be returned byTypeUsage.scope().
-
mergeFrom
public TypeUsage.Builder mergeFrom(TypeUsage value)
Copies values fromvalue, skipping empty optionals.- Returns:
- this
Builderobject
-
mergeFrom
public TypeUsage.Builder mergeFrom(TypeUsage.Builder template)
Copies values fromtemplate, skipping empty optionals and unset properties.- Returns:
- this
Builderobject
-
clear
public TypeUsage.Builder clear()
Resets the state of this builder.- Returns:
- this
Builderobject
-
build
public TypeUsage build()
Returns a newly-createdTypeUsagebased on the contents of thisBuilder.- Throws:
java.lang.IllegalStateException- if any field has not been set
-
buildPartial
public TypeUsage buildPartial()
Returns a newly-created partialTypeUsagefor 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(TypeUsage)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.
-
-