EclipseJDT Source Viewer

Home|eclipse_jdt/src/org/eclipse/jdt/core/dom/NullLiteral.java
1/*******************************************************************************
2 * Copyright (c) 2000, 2013 IBM Corporation and others.
3 *
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
8 *
9 * SPDX-License-Identifier: EPL-2.0
10 *
11 * Contributors:
12 *     IBM Corporation - initial API and implementation
13 *******************************************************************************/
14
15package org.eclipse.jdt.core.dom;
16
17import java.util.ArrayList;
18import java.util.List;
19
20/**
21 * Null literal node.
22 *
23 * @since 2.0
24 * @noinstantiate This class is not intended to be instantiated by clients.
25 */
26@SuppressWarnings("rawtypes")
27public class NullLiteral extends Expression {
28
29    /**
30     * A list of property descriptors (element type:
31     * {@link StructuralPropertyDescriptor}),
32     * or null if uninitialized.
33     */
34    private static final List PROPERTY_DESCRIPTORS;
35
36    static {
37        List propertyList = new ArrayList(1);
38        createPropertyList(NullLiteral.classpropertyList);
39        PROPERTY_DESCRIPTORS = reapPropertyList(propertyList);
40    }
41
42    /**
43     * Returns a list of structural property descriptors for this node type.
44     * Clients must not modify the result.
45     *
46     * @param apiLevel the API level; one of the
47     * <code>AST.JLS*</code> constants
48
49     * @return a list of property descriptors (element type:
50     * {@link StructuralPropertyDescriptor})
51     * @since 3.0
52     */
53    public static List propertyDescriptors(int apiLevel) {
54        return PROPERTY_DESCRIPTORS;
55    }
56
57    /**
58     * Creates a new unparented null literal node owned by the given AST.
59     * <p>
60     * N.B. This constructor is package-private.
61     * </p>
62     *
63     * @param ast the AST that is to own this node
64     */
65    NullLiteral(AST ast) {
66        super(ast);
67    }
68
69    @Override
70    final List internalStructuralPropertiesForType(int apiLevel) {
71        return propertyDescriptors(apiLevel);
72    }
73
74    @Override
75    final int getNodeType0() {
76        return NULL_LITERAL;
77    }
78
79    @Override
80    ASTNode clone0(AST target) {
81        NullLiteral result = new NullLiteral(target);
82        result.setSourceRange(getStartPosition(), getLength());
83        return result;
84    }
85
86    @Override
87    final boolean subtreeMatch0(ASTMatcher matcherObject other) {
88        // dispatch to correct overloaded match method
89        return matcher.match(this, other);
90    }
91
92    @Override
93    void accept0(ASTVisitor visitor) {
94        visitor.visit(this);
95        visitor.endVisit(this);
96    }
97
98    @Override
99    int memSize() {
100        return BASE_NODE_SIZE;
101    }
102
103    @Override
104    int treeSize() {
105        return memSize();
106    }
107}
108
109
MembersX
NullLiteral:internalStructuralPropertiesForType
NullLiteral:getNodeType0
NullLiteral:clone0
NullLiteral:accept0
NullLiteral:memSize
NullLiteral:subtreeMatch0
NullLiteral:treeSize
NullLiteral:NullLiteral
NullLiteral:PROPERTY_DESCRIPTORS
NullLiteral:clone0:Block:result
NullLiteral:propertyDescriptors
NullLiteral:Block:propertyList
Members
X