1 /*
2 * Themis: Java Project Framework
3 * Copyright 2012-2026. Tony Washer
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy
7 * of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17 package io.github.tonywasher.joceanus.themis.xanalysis.solver.reflect;
18
19 import com.github.javaparser.ast.body.AnnotationDeclaration;
20 import com.github.javaparser.ast.expr.SimpleName;
21
22 import java.util.Optional;
23
24 /**
25 * Resolved annotation JavaParser representation.
26 */
27 public class ThemisXAnalysisReflectAnnotation
28 extends AnnotationDeclaration {
29 /**
30 * The underlying class.
31 */
32 private final Class<?> theClass;
33
34 /**
35 * The fully qualified name.
36 */
37 private final String theFullName;
38
39 /**
40 * Constructor.
41 *
42 * @param pClazz the class definition.
43 */
44 ThemisXAnalysisReflectAnnotation(final Class<?> pClazz) {
45 /* Store the class */
46 theClass = pClazz;
47
48 /* Store the fully qualified name */
49 theFullName = theClass.getCanonicalName();
50
51 /* Set the name */
52 setName(new SimpleName(theClass.getSimpleName()));
53
54 /* Set the modifiers */
55 setModifiers(ThemisXAnalysisReflectUtils.buildModifiers(theClass));
56 }
57
58 @Override
59 public Optional<String> getFullyQualifiedName() {
60 return Optional.of(theFullName);
61 }
62
63 @Override
64 public boolean isTopLevelType() {
65 return !theClass.isMemberClass();
66 }
67 }