JavaParser Source Viewer

Home|JavaParser/com/github/javaparser/resolution/declarations/ResolvedClassDeclaration.java
1/*
2 * Copyright (C) 2007-2010 JĂșlio Vilmar Gesser.
3 * Copyright (C) 2011, 2013-2020 The JavaParser Team.
4 *
5 * This file is part of JavaParser.
6 *
7 * JavaParser can be used either under the terms of
8 * a) the GNU Lesser General Public License as published by
9 *     the Free Software Foundation, either version 3 of the License, or
10 *     (at your option) any later version.
11 * b) the terms of the Apache License
12 *
13 * You should have received a copy of both licenses in LICENCE.LGPL and
14 * LICENCE.APACHE. Please refer to those files for details.
15 *
16 * JavaParser is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 * GNU Lesser General Public License for more details.
20 */
21
22package com.github.javaparser.resolution.declarations;
23
24import com.github.javaparser.ast.Node;
25import com.github.javaparser.resolution.types.ResolvedReferenceType;
26
27import java.util.List;
28import java.util.Optional;
29
30/**
31 * Declaration of a Class (not an interface or an enum).
32 *
33 * Note that it can be associated to a Node AST because anonymous class declarations return an incompatible
34 * node type, compared to classic class declarations.
35 *
36 * @author Federico Tomassetti
37 */
38public interface ResolvedClassDeclaration extends ResolvedReferenceTypeDeclaration,
39        ResolvedTypeParametrizableHasAccessSpecifierAssociableToAST<Node> {
40
41    /**
42     * This method should always return true.
43     */
44    @Override
45    default boolean isClass() {
46        return true;
47    }
48
49    /**
50     * This is a ReferenceTypeUsage because it could contain type typeParametersValues.
51     * For example: {@code class A extends B<Integer, String>}.
52     * <p>
53     * Note that only the Object class should not have a superclass and therefore
54     * return empty.
55     */
56    Optional<ResolvedReferenceTypegetSuperClass();
57
58    /**
59     * Return all the interfaces implemented directly by this class.
60     * It does not include the interfaces implemented by superclasses or extended
61     * by the interfaces implemented.
62     */
63    List<ResolvedReferenceTypegetInterfaces();
64
65    /**
66     * Get all superclasses, with all the type typeParametersValues expressed as functions of the type
67     * typeParametersValues of this declaration.
68     */
69    List<ResolvedReferenceTypegetAllSuperClasses();
70
71    /**
72     * Return all the interfaces implemented by this class, either directly or indirectly, including the interfaces
73     * extended by interfaces it implements.
74     * <p>
75     * Get all interfaces, with all the type typeParametersValues expressed as functions of the type
76     * typeParametersValues of this declaration.
77     */
78    List<ResolvedReferenceTypegetAllInterfaces();
79
80    ///
81    /// Constructors
82    ///
83
84    /**
85     * List of constructors available for the class.
86     * This list should also include the default constructor.
87     */
88    @Override
89    List<ResolvedConstructorDeclarationgetConstructors();
90
91}
92
MembersX
ResolvedClassDeclaration:getAllSuperClasses
ResolvedClassDeclaration:getConstructors
ResolvedClassDeclaration:isClass
ResolvedClassDeclaration:getSuperClass
ResolvedClassDeclaration:getInterfaces
ResolvedClassDeclaration:getAllInterfaces
Members
X