Class RecordTypeBuilder

java.lang.Object
com.google.javascript.rhino.jstype.RecordTypeBuilder

public final class RecordTypeBuilder extends Object
A builder for record types.
  • Constructor Details

    • RecordTypeBuilder

      public RecordTypeBuilder(JSTypeRegistry registry)
  • Method Details

    • addProperty

      @CanIgnoreReturnValue public RecordTypeBuilder addProperty(String name, JSType type, Node propertyNode)
      Adds a property with the given name and type to the record type. If you add a property that has already been added, then build() will fail.
      Parameters:
      name - the name of the new property
      type - the JSType of the new property
      propertyNode - the node that holds this property definition
      Returns:
      The builder itself for chaining purposes.
    • build

      public JSType build()
      Creates a record. Fails if any duplicate property names were added.
      Returns:
      The record type.