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.ObjectImplements type unioning logic, sinceUnionTypes 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.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UnionType.BuilderaddAlternate(JSType alternate)Adds an alternate to the union type under construction.UnionType.BuilderaddAlternates(java.util.Collection<? extends JSType> c)UnionType.BuilderaddAlternates(java.util.List<? extends JSType> list)JSTypebuild()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.Buildercannot be used again once this method is called.
-
-