Class PrimitiveOptionalProperty
java.lang.Object
org.inferred.freebuilder.processor.property.PropertyCodeGenerator
org.inferred.freebuilder.processor.property.PrimitiveOptionalProperty
This property class handles the primitive optional fields, including
OptionalDouble, OptionalLong, and OptionalInt.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class(package private) static enumNested classes/interfaces inherited from class PropertyCodeGenerator
PropertyCodeGenerator.Config, PropertyCodeGenerator.Initially -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final PrimitiveOptionalProperty.OptionalTypeprivate final Optional<FunctionalType> private final Optional<FunctionalType> Fields inherited from class PropertyCodeGenerator
datatype, property -
Constructor Summary
ConstructorsConstructorDescriptionPrimitiveOptionalProperty(Datatype datatype, Property property, PrimitiveOptionalProperty.OptionalType optional, Optional<FunctionalType> primitiveOperator, Optional<FunctionalType> optionalOperator) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAssignToBuilder(SourceBuilder code, Variable builder) Adds an assignment to the field on the builder from the Value/Partial implementation.voidAdd the accessor methods for the property to the builder's source code.voidAdd the field declaration for the property to the builder's source code.private voidaddClear(SourceBuilder code) voidaddClearField(SourceBuilder code) Adds a clear call for the property given a template builder to the builder's source code.voidaddFinalFieldAssignment(SourceBuilder code, Excerpt finalField, String builder) Add the final assignment of the property to the value object's source code.private voidaddGetter(SourceBuilder code) voidaddMergeFromBuilder(SourceBuilder code, String builder) Add a merge from builder for the property to the builder's source code.voidaddMergeFromValue(SourceBuilder code, String value) Add a merge from value for the property to the builder's source code.private voidaddOptionalMapper(SourceBuilder code, FunctionalType mapperType) private voidprivate voidaddPrimitiveMapper(SourceBuilder code, FunctionalType mapperType) voidaddSetFromResult(SourceBuilder code, Excerpt builder, Excerpt variable) Adds a set call for the property from a function result to the builder's source code.private voidaddSetter(SourceBuilder code) voidAdds condition statement for an initially optional property to be included in the toString output for the Value/Partial types.voidAdds value to an ongoing toString concatenation or append sequence.voidAdd the field declaration for the property to the value's source code.Returns the actions taken in mergeFrom, for generating JavaDoc.Returns whether the property is required, optional, or has a default.Methods inherited from class PropertyCodeGenerator
addAccessorAnnotations, addGetterAnnotations, addPartialFieldAssignment, addPutAnnotations, addReadValueFragment, equals, hashCode, toString
-
Field Details
-
optional
-
primitiveOperator
-
optionalOperator
-
-
Constructor Details
-
PrimitiveOptionalProperty
PrimitiveOptionalProperty(Datatype datatype, Property property, PrimitiveOptionalProperty.OptionalType optional, Optional<FunctionalType> primitiveOperator, Optional<FunctionalType> optionalOperator)
-
-
Method Details
-
initialState
Description copied from class:PropertyCodeGeneratorReturns whether the property is required, optional, or has a default.- Overrides:
initialStatein classPropertyCodeGenerator
-
addValueFieldDeclaration
Description copied from class:PropertyCodeGeneratorAdd the field declaration for the property to the value's source code.- Specified by:
addValueFieldDeclarationin classPropertyCodeGenerator
-
addBuilderFieldDeclaration
Description copied from class:PropertyCodeGeneratorAdd the field declaration for the property to the builder's source code.- Specified by:
addBuilderFieldDeclarationin classPropertyCodeGenerator
-
addBuilderFieldAccessors
Description copied from class:PropertyCodeGeneratorAdd the accessor methods for the property to the builder's source code.- Specified by:
addBuilderFieldAccessorsin classPropertyCodeGenerator
-
addSetter
-
addOptionalSetter
-
addPrimitiveMapper
-
addOptionalMapper
-
addClear
-
addGetter
-
addFinalFieldAssignment
Description copied from class:PropertyCodeGeneratorAdd the final assignment of the property to the value object's source code.- Specified by:
addFinalFieldAssignmentin classPropertyCodeGenerator
-
addAssignToBuilder
Description copied from class:PropertyCodeGeneratorAdds an assignment to the field on the builder from the Value/Partial implementation.- Specified by:
addAssignToBuilderin classPropertyCodeGenerator
-
addMergeFromValue
Description copied from class:PropertyCodeGeneratorAdd a merge from value for the property to the builder's source code.- Specified by:
addMergeFromValuein classPropertyCodeGenerator
-
addMergeFromBuilder
Description copied from class:PropertyCodeGeneratorAdd a merge from builder for the property to the builder's source code.- Specified by:
addMergeFromBuilderin classPropertyCodeGenerator
-
getMergeActions
Description copied from class:PropertyCodeGeneratorReturns the actions taken in mergeFrom, for generating JavaDoc.- Specified by:
getMergeActionsin classPropertyCodeGenerator
-
addSetFromResult
Description copied from class:PropertyCodeGeneratorAdds a set call for the property from a function result to the builder's source code.- Specified by:
addSetFromResultin classPropertyCodeGenerator
-
addClearField
Description copied from class:PropertyCodeGeneratorAdds a clear call for the property given a template builder to the builder's source code.- Specified by:
addClearFieldin classPropertyCodeGenerator
-
addToStringCondition
Description copied from class:PropertyCodeGeneratorAdds condition statement for an initially optional property to be included in the toString output for the Value/Partial types.- Overrides:
addToStringConditionin classPropertyCodeGenerator
-
addToStringValue
Description copied from class:PropertyCodeGeneratorAdds value to an ongoing toString concatenation or append sequence.- Overrides:
addToStringValuein classPropertyCodeGenerator
-