Class RecordTypeBuilder
- java.lang.Object
-
- com.google.javascript.rhino.jstype.RecordTypeBuilder
-
public class RecordTypeBuilder extends java.lang.Object
A builder for record types.
-
-
Constructor Summary
Constructors Constructor Description RecordTypeBuilder(JSTypeRegistry registry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RecordTypeBuilder
addProperty(java.lang.String name, JSType type, Node propertyNode)
Adds a property with the given name and type to the record type.JSType
build()
Creates a record.
-
-
-
Constructor Detail
-
RecordTypeBuilder
public RecordTypeBuilder(JSTypeRegistry registry)
-
-
Method Detail
-
addProperty
public RecordTypeBuilder addProperty(java.lang.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
public JSType build()
Creates a record. Fails if any duplicate property names were added.- Returns:
- The record type.
-
-