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 Object
Auto-generated superclass of
TypeUsage.Builder, derived from the API of TypeUsage.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classprivate static enumprivate static classprivate static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final EnumSet<TypeUsage_Builder.Property> private intprivate QualifiedNameprivate intprivate QualifiedName -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Returns a newly-createdTypeUsagebased on the contents of thisBuilder.Returns a newly-created partialTypeUsagefor use in unit tests.clear()Resets the state of this builder.Sets the value to be returned byTypeUsage.scope()toOptional.empty().intend()Returns the value that will be returned byTypeUsage.end().end(int end) Sets the value to be returned byTypeUsage.end().static TypeUsage.BuilderCreates a new builder usingvalueas a template.mapEnd(IntUnaryOperator mapper) Replaces the value to be returned byTypeUsage.end()by applyingmapperto it and using the result.mapScope(UnaryOperator<QualifiedName> mapper) If the value to be returned byTypeUsage.scope()is present, replaces it by applyingmapperto it and using the result.mapStart(IntUnaryOperator mapper) Replaces the value to be returned byTypeUsage.start()by applyingmapperto it and using the result.mapType(UnaryOperator<QualifiedName> mapper) Replaces the value to be returned byTypeUsage.type()by applyingmapperto it and using the result.Copies values fromvalue, skipping empty optionals.mergeFrom(TypeUsage.Builder template) Copies values fromtemplate, skipping empty optionals and unset properties.nullableScope(QualifiedName scope) Sets the value to be returned byTypeUsage.scope().scope()Returns the value that will be returned byTypeUsage.scope().scope(Optional<? extends QualifiedName> scope) Sets the value to be returned byTypeUsage.scope().scope(QualifiedName scope) Sets the value to be returned byTypeUsage.scope().intstart()Returns the value that will be returned byTypeUsage.start().start(int start) Sets the value to be returned byTypeUsage.start().type()Returns the value that will be returned byTypeUsage.type().type(QualifiedName type) Sets the value to be returned byTypeUsage.type().
-
Field Details
-
start
private int start -
end
private int end -
type
-
scope
-
_unsetProperties
-
-
Constructor Details
-
TypeUsage_Builder
TypeUsage_Builder()
-
-
Method Details
-
from
Creates a new builder usingvalueas a template.If
valueis a partial, the builder will return more partials. -
start
Sets the value to be returned byTypeUsage.start().- Returns:
- this
Builderobject
-
mapStart
Replaces the value to be returned byTypeUsage.start()by applyingmapperto it and using the result.- Returns:
- this
Builderobject - Throws:
NullPointerException- ifmapperis nullIllegalStateException- if the field has not been set
-
start
public int start()Returns the value that will be returned byTypeUsage.start().- Throws:
IllegalStateException- if the field has not been set
-
end
Sets the value to be returned byTypeUsage.end().- Returns:
- this
Builderobject
-
mapEnd
Replaces the value to be returned byTypeUsage.end()by applyingmapperto it and using the result.- Returns:
- this
Builderobject - Throws:
NullPointerException- ifmapperis nullIllegalStateException- if the field has not been set
-
end
public int end()Returns the value that will be returned byTypeUsage.end().- Throws:
IllegalStateException- if the field has not been set
-
type
Sets the value to be returned byTypeUsage.type().- Returns:
- this
Builderobject - Throws:
NullPointerException- iftypeis null
-
mapType
Replaces the value to be returned byTypeUsage.type()by applyingmapperto it and using the result.- Returns:
- this
Builderobject - Throws:
NullPointerException- ifmapperis null or returns nullIllegalStateException- if the field has not been set
-
type
Returns the value that will be returned byTypeUsage.type().- Throws:
IllegalStateException- if the field has not been set
-
scope
Sets the value to be returned byTypeUsage.scope().- Returns:
- this
Builderobject - Throws:
NullPointerException- ifscopeis null
-
scope
Sets the value to be returned byTypeUsage.scope().- Returns:
- this
Builderobject
-
nullableScope
Sets the value to be returned byTypeUsage.scope().- Returns:
- this
Builderobject
-
mapScope
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:
NullPointerException- ifmapperis null
-
clearScope
Sets the value to be returned byTypeUsage.scope()toOptional.empty().- Returns:
- this
Builderobject
-
scope
Returns the value that will be returned byTypeUsage.scope(). -
mergeFrom
Copies values fromvalue, skipping empty optionals.- Returns:
- this
Builderobject
-
mergeFrom
Copies values fromtemplate, skipping empty optionals and unset properties.- Returns:
- this
Builderobject
-
clear
-
build
Returns a newly-createdTypeUsagebased on the contents of thisBuilder.- Throws:
IllegalStateException- if any field has not been set
-
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.
-