Class OptionalProperty
java.lang.Object
org.inferred.freebuilder.processor.property.PropertyCodeGenerator
org.inferred.freebuilder.processor.property.OptionalProperty
PropertyCodeGenerator providing a default value (absent/empty) and convenience setter
methods for Guava and Java 8 Optional properties.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class(package private) static enumNested classes/interfaces inherited from class org.inferred.freebuilder.processor.property.PropertyCodeGenerator
PropertyCodeGenerator.Config, PropertyCodeGenerator.Initially -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TypeMirrorprivate final FunctionalTypeprivate final OptionalProperty.OptionalTypeprivate final Optional<TypeMirror> Fields inherited from class org.inferred.freebuilder.processor.property.PropertyCodeGenerator
datatype, property -
Constructor Summary
ConstructorsConstructorDescriptionOptionalProperty(Datatype datatype, Property property, OptionalProperty.OptionalType optional, TypeMirror elementType, Optional<TypeMirror> unboxedType, FunctionalType mapperType) -
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) private voidaddMapper(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 voidprivate voidvoidaddReadValueFragment(SourceBuilder code, Excerpt finalField) Adds a fragment converting the value object's field to the property's type.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) 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 org.inferred.freebuilder.processor.property.PropertyCodeGenerator
addAccessorAnnotations, addGetterAnnotations, addPartialFieldAssignment, addPutAnnotations, addToStringCondition, addToStringValue, equals, hashCode, toString
-
Field Details
-
optional
-
elementType
-
unboxedType
-
mapperType
-
-
Constructor Details
-
OptionalProperty
OptionalProperty(Datatype datatype, Property property, OptionalProperty.OptionalType optional, TypeMirror elementType, Optional<TypeMirror> unboxedType, FunctionalType mapperType)
-
-
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
-
addNullableSetter
-
addMapper
-
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
-
addReadValueFragment
Description copied from class:PropertyCodeGeneratorAdds a fragment converting the value object's field to the property's type.- Overrides:
addReadValueFragmentin 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
-