View Javadoc
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.parser.mod;
18  
19  import com.github.javaparser.ast.modules.ModuleDeclaration;
20  import io.github.tonywasher.joceanus.oceanus.base.OceanusException;
21  import io.github.tonywasher.joceanus.themis.xanalysis.parser.base.ThemisXAnalysisParserDef;
22  
23  import java.util.List;
24  
25  /**
26   * Module.
27   */
28  public class ThemisXAnalysisModModule
29          extends ThemisXAnalysisBaseModule<ModuleDeclaration> {
30      /**
31       * The Name.
32       */
33      private final ThemisXAnalysisNodeInstance theName;
34  
35      /**
36       * The Directives.
37       */
38      private final List<ThemisXAnalysisModuleInstance> theDirectives;
39  
40      /**
41       * The annotations.
42       */
43      private final List<ThemisXAnalysisExpressionInstance> theAnnotations;
44  
45      /**
46       * Constructor.
47       *
48       * @param pParser      the parser
49       * @param pDeclaration the declaration
50       * @throws OceanusException on error
51       */
52      ThemisXAnalysisModModule(final ThemisXAnalysisParserDef pParser,
53                               final ModuleDeclaration pDeclaration) throws OceanusException {
54          super(pParser, pDeclaration);
55          theName = pParser.parseNode(pDeclaration.getName());
56          theDirectives = pParser.parseModuleList(pDeclaration.getDirectives());
57          theAnnotations = pParser.parseExprList(pDeclaration.getAnnotations());
58      }
59  
60      /**
61       * Obtain the name.
62       *
63       * @return the name
64       */
65      public ThemisXAnalysisNodeInstance getName() {
66          return theName;
67      }
68  
69      /**
70       * Obtain the directives.
71       *
72       * @return the directives
73       */
74      public List<ThemisXAnalysisModuleInstance> getDirectives() {
75          return theDirectives;
76      }
77  
78      /**
79       * Obtain the annotations.
80       *
81       * @return the annotations
82       */
83      public List<ThemisXAnalysisExpressionInstance> getAnnotations() {
84          return theAnnotations;
85      }
86  }