Class PrimitiveOptionalProperty
- java.lang.Object
-
- org.inferred.freebuilder.processor.property.PropertyCodeGenerator
-
- org.inferred.freebuilder.processor.property.PrimitiveOptionalProperty
-
public class PrimitiveOptionalProperty extends PropertyCodeGenerator
This property class handles the primitive optional fields, includingOptionalDouble,OptionalLong, andOptionalInt.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classPrimitiveOptionalProperty.Factory(package private) static classPrimitiveOptionalProperty.OptionalType-
Nested classes/interfaces inherited from class org.inferred.freebuilder.processor.property.PropertyCodeGenerator
PropertyCodeGenerator.Config, PropertyCodeGenerator.Initially
-
-
Field Summary
Fields Modifier and Type Field Description private PrimitiveOptionalProperty.OptionalTypeoptionalprivate java.util.Optional<FunctionalType>optionalOperatorprivate java.util.Optional<FunctionalType>primitiveOperator-
Fields inherited from class org.inferred.freebuilder.processor.property.PropertyCodeGenerator
datatype, property
-
-
Constructor Summary
Constructors Constructor Description PrimitiveOptionalProperty(Datatype datatype, Property property, PrimitiveOptionalProperty.OptionalType optional, java.util.Optional<FunctionalType> primitiveOperator, java.util.Optional<FunctionalType> optionalOperator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAssignToBuilder(SourceBuilder code, Variable builder)Adds an assignment to the field on the builder from the Value/Partial implementation.voidaddBuilderFieldAccessors(SourceBuilder code)Add the accessor methods for the property to the builder's source code.voidaddBuilderFieldDeclaration(SourceBuilder code)Add 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, java.lang.String builder)Add the final assignment of the property to the value object's source code.private voidaddGetter(SourceBuilder code)voidaddMergeFromBuilder(SourceBuilder code, java.lang.String builder)Add a merge from builder for the property to the builder's source code.voidaddMergeFromValue(SourceBuilder code, java.lang.String value)Add a merge from value for the property to the builder's source code.private voidaddOptionalMapper(SourceBuilder code, FunctionalType mapperType)private voidaddOptionalSetter(SourceBuilder code)private 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)voidaddToStringCondition(SourceBuilder code)Adds condition statement for an initially optional property to be included in the toString output for the Value/Partial types.voidaddToStringValue(SourceBuilder code)Adds value to an ongoing toString concatenation or append sequence.voidaddValueFieldDeclaration(SourceBuilder code)Add the field declaration for the property to the value's source code.java.util.Set<MergeAction>getMergeActions()Returns the actions taken in mergeFrom, for generating JavaDoc.PropertyCodeGenerator.InitiallyinitialState()Returns whether the property is required, optional, or has a default.-
Methods inherited from class org.inferred.freebuilder.processor.property.PropertyCodeGenerator
addAccessorAnnotations, addGetterAnnotations, addPartialFieldAssignment, addPutAnnotations, addReadValueFragment, equals, hashCode, toString
-
-
-
-
Field Detail
-
optional
private final PrimitiveOptionalProperty.OptionalType optional
-
primitiveOperator
private final java.util.Optional<FunctionalType> primitiveOperator
-
optionalOperator
private final java.util.Optional<FunctionalType> optionalOperator
-
-
Constructor Detail
-
PrimitiveOptionalProperty
PrimitiveOptionalProperty(Datatype datatype, Property property, PrimitiveOptionalProperty.OptionalType optional, java.util.Optional<FunctionalType> primitiveOperator, java.util.Optional<FunctionalType> optionalOperator)
-
-
Method Detail
-
initialState
public PropertyCodeGenerator.Initially initialState()
Description copied from class:PropertyCodeGeneratorReturns whether the property is required, optional, or has a default.- Overrides:
initialStatein classPropertyCodeGenerator
-
addValueFieldDeclaration
public void addValueFieldDeclaration(SourceBuilder code)
Description copied from class:PropertyCodeGeneratorAdd the field declaration for the property to the value's source code.- Specified by:
addValueFieldDeclarationin classPropertyCodeGenerator
-
addBuilderFieldDeclaration
public void addBuilderFieldDeclaration(SourceBuilder code)
Description copied from class:PropertyCodeGeneratorAdd the field declaration for the property to the builder's source code.- Specified by:
addBuilderFieldDeclarationin classPropertyCodeGenerator
-
addBuilderFieldAccessors
public void addBuilderFieldAccessors(SourceBuilder code)
Description copied from class:PropertyCodeGeneratorAdd the accessor methods for the property to the builder's source code.- Specified by:
addBuilderFieldAccessorsin classPropertyCodeGenerator
-
addSetter
private void addSetter(SourceBuilder code)
-
addOptionalSetter
private void addOptionalSetter(SourceBuilder code)
-
addPrimitiveMapper
private void addPrimitiveMapper(SourceBuilder code, FunctionalType mapperType)
-
addOptionalMapper
private void addOptionalMapper(SourceBuilder code, FunctionalType mapperType)
-
addClear
private void addClear(SourceBuilder code)
-
addGetter
private void addGetter(SourceBuilder code)
-
addFinalFieldAssignment
public void addFinalFieldAssignment(SourceBuilder code, Excerpt finalField, java.lang.String builder)
Description copied from class:PropertyCodeGeneratorAdd the final assignment of the property to the value object's source code.- Specified by:
addFinalFieldAssignmentin classPropertyCodeGenerator
-
addAssignToBuilder
public void addAssignToBuilder(SourceBuilder code, Variable builder)
Description copied from class:PropertyCodeGeneratorAdds an assignment to the field on the builder from the Value/Partial implementation.- Specified by:
addAssignToBuilderin classPropertyCodeGenerator
-
addMergeFromValue
public void addMergeFromValue(SourceBuilder code, java.lang.String value)
Description copied from class:PropertyCodeGeneratorAdd a merge from value for the property to the builder's source code.- Specified by:
addMergeFromValuein classPropertyCodeGenerator
-
addMergeFromBuilder
public void addMergeFromBuilder(SourceBuilder code, java.lang.String builder)
Description copied from class:PropertyCodeGeneratorAdd a merge from builder for the property to the builder's source code.- Specified by:
addMergeFromBuilderin classPropertyCodeGenerator
-
getMergeActions
public java.util.Set<MergeAction> getMergeActions()
Description copied from class:PropertyCodeGeneratorReturns the actions taken in mergeFrom, for generating JavaDoc.- Specified by:
getMergeActionsin classPropertyCodeGenerator
-
addSetFromResult
public void addSetFromResult(SourceBuilder code, Excerpt builder, Excerpt variable)
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
public void addClearField(SourceBuilder code)
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
public void addToStringCondition(SourceBuilder code)
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
public void addToStringValue(SourceBuilder code)
Description copied from class:PropertyCodeGeneratorAdds value to an ongoing toString concatenation or append sequence.- Overrides:
addToStringValuein classPropertyCodeGenerator
-
-