public static final class UnionType.Builder
extends java.lang.Object
UnionTypes only actually need to perform unioning
operations when being (re)built.
UnionType.Builders 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.
| Modifier and Type | Method and 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 a
UnionType, that represents the union of the inputs. |
public UnionType.Builder addAlternates(java.util.Collection<? extends JSType> c)
public UnionType.Builder addAlternates(java.util.List<? extends JSType> list)
public UnionType.Builder addAlternate(JSType alternate)
Returns this for easy chaining.
public JSType build()
UnionType, that represents the union of the inputs.
The UnionType.Builder cannot be used again once this method is called.
Copyright © 2009-2020 Google. All Rights Reserved.