All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.pmd.lang.apex.ast.ASTUserClass Maven / Gradle / Ivy

There is a newer version: 7.5.0
Show newest version
/*
 * 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 com.google.summit.ast.TypeRef;
import com.google.summit.ast.declaration.ClassDeclaration;

public final class ASTUserClass extends BaseApexClass implements ASTUserClassOrInterface {

    ASTUserClass(ClassDeclaration userClass) {
        super(userClass);
    }

    @Override
    protected  R acceptApexVisitor(ApexVisitor visitor, P data) {
        return visitor.visit(this, data);
    }


    /**
     * Returns the name of the superclass of this class, or an empty string if there is none.
     *
     * The type name does NOT include type arguments.
     */
    public String getSuperClassName() {
        TypeRef extendsType = node.getExtendsType();
        if (extendsType != null) {
            return extendsType.asTypeErasedString();
        }
        return "";
    }

    /**
     * Returns a list of the names of the interfaces implemented by this class.
     *
     * The type names do NOT include type arguments. (This is tested.)
     */
    public List getInterfaceNames() {
        return node.getImplementsTypes().stream()
            .map(TypeRef::asTypeErasedString)
            .collect(Collectors.toList());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy