-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
ASTUserClass.java
36 lines (28 loc) · 1.22 KB
/
ASTUserClass.java
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
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.apex.ast;
import java.util.List;
import java.util.stream.Collectors;
import apex.jorje.data.Identifier;
import apex.jorje.data.ast.TypeRef;
import apex.jorje.semantic.ast.compilation.UserClass;
public final class ASTUserClass extends BaseApexClass<UserClass> implements ASTUserClassOrInterface<UserClass> {
ASTUserClass(UserClass userClass) {
super(userClass);
}
@Override
protected <P, R> R acceptApexVisitor(ApexVisitor<? super P, ? extends R> visitor, P data) {
return visitor.visit(this, data);
}
public String getSuperClassName() {
return node.getDefiningType().getCodeUnitDetails().getSuperTypeRef().map(TypeRef::getNames)
.map(it -> it.stream().map(Identifier::getValue).collect(Collectors.joining(".")))
.orElse("");
}
public List<String> getInterfaceNames() {
return node.getDefiningType().getCodeUnitDetails().getInterfaceTypeRefs().stream()
.map(TypeRef::getNames).map(it -> it.stream().map(Identifier::getValue).collect(Collectors.joining(".")))
.collect(Collectors.toList());
}
}