public static Optional < Variable > freshBuilder ( SourceBuilder code , Datatype datatype ) { if ( ! datatype . getBuilderFactory ( ) . isPresent ( ) ) { return Optional . empty ( ) ; } return Optional . of ( code . scope ( ) . computeIfAbsent ( Declaration . FRESH_BUILDER , ( ) -> { Variable defaults = new Variable ( "defaults" ) ; code . addLine ( "%s %s = %s;" , datatype . getGeneratedBuilder ( ) , defaults , datatype . getBuilderFactory ( ) . get ( ) . newBuilder ( datatype . getBuilder ( ) , TypeInference . INFERRED_TYPES ) ) ; return defaults ; } ) ) ; }
Declares a fresh Builder to copy default property values from .