1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
package com.github.javaparser.ast.modules;
import com.github.javaparser.Range;
import com.github.javaparser.ast.AllFieldsConstructor;
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.NodeList;
import com.github.javaparser.ast.nodeTypes.NodeWithType;
import com.github.javaparser.ast.observer.ObservableProperty;
import com.github.javaparser.ast.type.ClassOrInterfaceType;
import com.github.javaparser.ast.type.Type;
import com.github.javaparser.ast.visitor.CloneVisitor;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
import com.github.javaparser.metamodel.JavaParserMetaModel;
import com.github.javaparser.metamodel.ModuleProvidesStmtMetaModel;
import java.util.Arrays;
import java.util.List;
import static com.github.javaparser.utils.Utils.assertNotNull;
import javax.annotation.Generated;
public class ModuleProvidesStmt extends ModuleStmt implements NodeWithType<ModuleProvidesStmt, Type> {
private Type type;
private NodeList<Type> withTypes;
public ModuleProvidesStmt() {
this(null, new ClassOrInterfaceType(), new NodeList<>());
}
@AllFieldsConstructor
public ModuleProvidesStmt(Type type, NodeList<Type> withTypes) {
this(null, type, withTypes);
}
/**This constructor is used by the parser and is considered private.*/
@Generated("com.github.javaparser.generator.core.node.MainConstructorGenerator")
public ModuleProvidesStmt(Range range, Type type, NodeList<Type> withTypes) {
super(range);
setType(type);
setWithTypes(withTypes);
customInitialization();
}
@Override
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
return v.visit(this, arg);
}
@Override
public <A> void accept(VoidVisitor<A> v, A arg) {
v.visit(this, arg);
}
@Override
public boolean remove(Node node) {
if (node == null)
return false;
for (int i = 0; i < withTypes.size(); i++) {
if (withTypes.get(i) == node) {
withTypes.remove(i);
return true;
}
}
return super.remove(node);
}
public Type getType() {
return type;
}
public ModuleProvidesStmt setType(final Type type) {
assertNotNull(type);
if (type == this.type) {
return (ModuleProvidesStmt) this;
}
notifyPropertyChange(ObservableProperty.TYPE, this.type, type);
if (this.type != null)
this.type.setParentNode(null);
this.type = type;
setAsParentNodeOf(type);
return this;
}
public NodeList<Type> getWithTypes() {
return withTypes;
}
public ModuleProvidesStmt setWithTypes(final NodeList<Type> withTypes) {
assertNotNull(withTypes);
if (withTypes == this.withTypes) {
return (ModuleProvidesStmt) this;
}
notifyPropertyChange(ObservableProperty.WITH_TYPES, this.withTypes, withTypes);
if (this.withTypes != null)
this.withTypes.setParentNode(null);
this.withTypes = withTypes;
setAsParentNodeOf(withTypes);
return this;
}
@Override
public List<NodeList<?>> getNodeLists() {
return Arrays.asList(getWithTypes());
}
@Override
public ModuleProvidesStmt clone() {
return (ModuleProvidesStmt) accept(new CloneVisitor(), null);
}
@Override
public ModuleProvidesStmtMetaModel getMetaModel() {
return JavaParserMetaModel.moduleProvidesStmtMetaModel;
}
}
|