class UnionType extends Type implements NodeWithAnnotations<UnionType> {

    @NonEmptyProperty
    private NodeList<ReferenceType> elements;

    public UnionType() {
        this(null, new NodeList<>());
    }

    /**
     * This constructor is used by the parser and is considered private.
     */
    @Generated("com.github.javaparser.generator.core.node.MainConstructorGenerator")
    public UnionType(TokenRange tokenRange, NodeList<ReferenceType> elements) {
        super(tokenRange);
        setElements(elements);
        customInitialization();
    }

    @AllFieldsConstructor
    public UnionType(NodeList<ReferenceType> elements) {
        this(null, elements);
    }

    @Generated("com.github.javaparser.generator.core.node.PropertyGenerator")
    public NodeList<ReferenceType> getElements() {
        return elements;
    }

    @Generated("com.github.javaparser.generator.core.node.PropertyGenerator")
    public UnionType setElements(final NodeList<ReferenceType> elements) {
        assertNotNull(elements);
        if (elements == this.elements) {
            return this;
        }
        notifyPropertyChange(ObservableProperty.ELEMENTS, this.elements, elements);
        if (this.elements != null)
            this.elements.setParentNode(null);
        this.elements = elements;
        setAsParentNodeOf(elements);
        return this;
    }

    @Override
    public UnionType setAnnotations(NodeList<AnnotationExpr> annotations) {
        return (UnionType) super.setAnnotations(annotations);
    }

    @Override
    @Generated("com.github.javaparser.generator.core.node.AcceptGenerator")
    public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
        return v.visit(this, arg);
    }

    @Override
    @Generated("com.github.javaparser.generator.core.node.AcceptGenerator")
    public <A> void accept(final VoidVisitor<A> v, final A arg) {
        v.visit(this, arg);
    }

    @Override
    @Generated("com.github.javaparser.generator.core.node.RemoveMethodGenerator")
    public boolean remove(Node node) {<FILL_FUNCTION_BODY>}

    @Override
    public String asString() {
        return elements.stream().map(Type::asString).collect(joining("|"));
    }

    @Override
    @Generated("com.github.javaparser.generator.core.node.CloneGenerator")
    public UnionType clone() {
        return (UnionType) accept(new CloneVisitor(), null);
    }

    @Override
    @Generated("com.github.javaparser.generator.core.node.GetMetaModelGenerator")
    public UnionTypeMetaModel getMetaModel() {
        return JavaParserMetaModel.unionTypeMetaModel;
    }

    @Override
    @Generated("com.github.javaparser.generator.core.node.ReplaceMethodGenerator")
    public boolean replace(Node node, Node replacementNode) {
        if (node == null) {
            return false;
        }
        for (int i = 0; i < elements.size(); i++) {
            if (elements.get(i) == node) {
                elements.set(i, (ReferenceType) replacementNode);
                return true;
            }
        }
        return super.replace(node, replacementNode);
    }

    @Override
    @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
    public boolean isUnionType() {
        return true;
    }

    @Override
    @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
    public UnionType asUnionType() {
        return this;
    }

    @Override
    @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
    public void ifUnionType(Consumer<UnionType> action) {
        action.accept(this);
    }

    @Override
    public ResolvedUnionType resolve() {
        return getSymbolResolver().toResolvedType(this, ResolvedUnionType.class);
    }

    @Override
    @Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator")
    public Optional<UnionType> toUnionType() {
        return Optional.of(this);
    }

	@Override
	public ResolvedType convertToUsage(Context context) {
		List<ResolvedType> resolvedElements = getElements().stream()
                .map(el -> el.convertToUsage(context))
                .collect(Collectors.toList());
        return new ResolvedUnionType(resolvedElements);
	}
}

        if (node == null) {
            return false;
        }
        for (int i = 0; i < elements.size(); i++) {
            if (elements.get(i) == node) {
                elements.remove(i);
                return true;
            }
        }
        return super.remove(node);
    
<methods>public void <init>(NodeList<com.github.javaparser.ast.expr.AnnotationExpr>) ,public void <init>(com.github.javaparser.TokenRange, NodeList<com.github.javaparser.ast.expr.AnnotationExpr>) ,public com.github.javaparser.ast.type.ArrayType asArrayType() ,public com.github.javaparser.ast.type.ClassOrInterfaceType asClassOrInterfaceType() ,public com.github.javaparser.ast.type.IntersectionType asIntersectionType() ,public com.github.javaparser.ast.type.PrimitiveType asPrimitiveType() ,public com.github.javaparser.ast.type.ReferenceType asReferenceType() ,public abstract java.lang.String asString() ,public com.github.javaparser.ast.type.TypeParameter asTypeParameter() ,public com.github.javaparser.ast.type.UnionType asUnionType() ,public com.github.javaparser.ast.type.UnknownType asUnknownType() ,public com.github.javaparser.ast.type.VarType asVarType() ,public com.github.javaparser.ast.type.VoidType asVoidType() ,public com.github.javaparser.ast.type.WildcardType asWildcardType() ,public com.github.javaparser.ast.type.Type clone() ,public com.github.javaparser.ast.expr.AnnotationExpr getAnnotation(int) ,public NodeList<com.github.javaparser.ast.expr.AnnotationExpr> getAnnotations() ,public int getArrayLevel() ,public com.github.javaparser.ast.type.Type getElementType() ,public com.github.javaparser.metamodel.TypeMetaModel getMetaModel() ,public void ifArrayType(Consumer<com.github.javaparser.ast.type.ArrayType>) ,public void ifClassOrInterfaceType(Consumer<com.github.javaparser.ast.type.ClassOrInterfaceType>) ,public void ifIntersectionType(Consumer<com.github.javaparser.ast.type.IntersectionType>) ,public void ifPrimitiveType(Consumer<com.github.javaparser.ast.type.PrimitiveType>) ,public void ifReferenceType(Consumer<com.github.javaparser.ast.type.ReferenceType>) ,public void ifTypeParameter(Consumer<com.github.javaparser.ast.type.TypeParameter>) ,public void ifUnionType(Consumer<com.github.javaparser.ast.type.UnionType>) ,public void ifUnknownType(Consumer<com.github.javaparser.ast.type.UnknownType>) ,public void ifVarType(Consumer<com.github.javaparser.ast.type.VarType>) ,public void ifVoidType(Consumer<com.github.javaparser.ast.type.VoidType>) ,public void ifWildcardType(Consumer<com.github.javaparser.ast.type.WildcardType>) ,public boolean isArrayType() ,public boolean isClassOrInterfaceType() ,public boolean isIntersectionType() ,public boolean isPrimitiveType() ,public boolean isReferenceType() ,public boolean isTypeParameter() ,public boolean isUnionType() ,public boolean isUnknownType() ,public boolean isVarType() ,public boolean isVoidType() ,public boolean isWildcardType() ,public boolean remove(com.github.javaparser.ast.Node) ,public boolean replace(com.github.javaparser.ast.Node, com.github.javaparser.ast.Node) ,public abstract com.github.javaparser.resolution.types.ResolvedType resolve() ,public com.github.javaparser.ast.type.Type setAnnotations(NodeList<com.github.javaparser.ast.expr.AnnotationExpr>) ,public Optional<com.github.javaparser.ast.type.ArrayType> toArrayType() ,public Optional<com.github.javaparser.ast.type.ClassOrInterfaceType> toClassOrInterfaceType() ,public java.lang.String toDescriptor() ,public Optional<com.github.javaparser.ast.type.IntersectionType> toIntersectionType() ,public Optional<com.github.javaparser.ast.type.PrimitiveType> toPrimitiveType() ,public Optional<com.github.javaparser.ast.type.ReferenceType> toReferenceType() ,public Optional<com.github.javaparser.ast.type.TypeParameter> toTypeParameter() ,public Optional<com.github.javaparser.ast.type.UnionType> toUnionType() ,public Optional<com.github.javaparser.ast.type.UnknownType> toUnknownType() ,public Optional<com.github.javaparser.ast.type.VarType> toVarType() ,public Optional<com.github.javaparser.ast.type.VoidType> toVoidType() ,public Optional<com.github.javaparser.ast.type.WildcardType> toWildcardType() <variables>private NodeList<com.github.javaparser.ast.expr.AnnotationExpr> annotations