Class UnionType

All Implemented Interfaces:
NodeWithAnnotations<UnionType>, NodeWithRange<Node>, NodeWithTokenRange<Node>, Observable, Visitable, HasParentNode<Node>, Resolvable<ResolvedType>, Cloneable

public class UnionType extends Type implements NodeWithAnnotations<UnionType>

The union type

Represents a set of types. A given value of this type has to be assignable to at least one of the element types.

Java 1-6

Does not exist.

Java 7+

As of Java 7 it is used in catch clauses.

 try {
 ...
 } catch(IOException | NullPointerException ex) {
 ...
 }
 
The types that make up the union type are its "elements"