Class UnionType.Builder
- java.lang.Object
-
- com.google.javascript.rhino.jstype.UnionType.Builder
-
- Enclosing class:
- UnionType
public static final class UnionType.Builder extends java.lang.Object
Implements type unioning logic, sinceUnionType
s only actually need to perform unioning operations when being (re)built.UnionType.Builder
s exist in two forms. One for assembing a new union and one for updating an existing union. Only the former is exposed.Most users of this class should prefer
JSTypeRegistry.createUnionType(com.google.javascript.rhino.jstype.JSType...)
instead.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UnionType.Builder
addAlternate(JSType alternate)
Adds an alternate to the union type under construction.UnionType.Builder
addAlternates(java.util.Collection<? extends JSType> c)
UnionType.Builder
addAlternates(java.util.List<? extends JSType> list)
JSType
build()
Returns a type, not necessarily aUnionType
, that represents the union of the inputs.
-
-
-
Method Detail
-
addAlternates
public UnionType.Builder addAlternates(java.util.Collection<? extends JSType> c)
-
addAlternates
public UnionType.Builder addAlternates(java.util.List<? extends JSType> list)
-
addAlternate
public UnionType.Builder addAlternate(JSType alternate)
Adds an alternate to the union type under construction.Returns this for easy chaining.
-
build
public JSType build()
Returns a type, not necessarily aUnionType
, that represents the union of the inputs.The
UnionType.Builder
cannot be used again once this method is called.
-
-