Class Declarations

java.lang.Object
org.inferred.freebuilder.processor.Declarations

public class Declarations extends Object
  • Field Details

  • Constructor Details

    • Declarations

      private Declarations()
  • Method Details

    • upcastToGeneratedBuilder

      public static Variable upcastToGeneratedBuilder(SourceBuilder code, Datatype datatype, 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 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.