Class Declarations


  • public class Declarations
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  Declarations.Declaration  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String UPCAST_COMMENT  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Declarations()  
    • Field Detail

    • Constructor Detail

      • Declarations

        private Declarations()
    • Method Detail

      • upcastToGeneratedBuilder

        public static Variable upcastToGeneratedBuilder​(SourceBuilder code,
                                                        Datatype datatype,
                                                        java.lang.String builder)
        Upcasts a Builder instance to the generated superclass, to allow access to private fields.

        Reuses an existing upcast instance if one was already declared in this scope.

        Parameters:
        code - the SourceBuilder to add the declaration to
        datatype - metadata about the user type the builder is being generated for
        builder - the Builder instance to upcast
      • freshBuilder

        public static java.util.Optional<Variable> freshBuilder​(SourceBuilder code,
                                                                Datatype datatype)
        Declares a fresh Builder to copy default property values from.

        Reuses an existing fresh Builder instance if one was already declared in this scope.