Class RecordTypeBuilder
java.lang.Object
com.google.javascript.rhino.jstype.RecordTypeBuilder
A builder for record types.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddProperty(String name, JSType type, Node propertyNode) Adds a property with the given name and type to the record type.build()Creates a record.
-
Constructor Details
-
RecordTypeBuilder
-
-
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, thenbuild()will fail.- Parameters:
name- the name of the new propertytype- the JSType of the new propertypropertyNode- the node that holds this property definition- Returns:
- The builder itself for chaining purposes.
-
build
Creates a record. Fails if any duplicate property names were added.- Returns:
- The record type.
-