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.parser.decl;
18  
19  import com.github.javaparser.ast.body.FieldDeclaration;
20  import io.github.tonywasher.joceanus.oceanus.base.OceanusException;
21  import io.github.tonywasher.joceanus.themis.parser.base.ThemisModifierList;
22  import io.github.tonywasher.joceanus.themis.parser.base.ThemisParserDef;
23  
24  import java.util.List;
25  
26  /**
27   * Field Declaration.
28   */
29  public class ThemisDeclField
30          extends ThemisBaseDeclaration<FieldDeclaration> {
31      /**
32       * The modifiers.
33       */
34      private final ThemisModifierList theModifiers;
35  
36      /**
37       * The variables.
38       */
39      private final List<ThemisNodeInstance> theVariables;
40  
41      /**
42       * The annotations.
43       */
44      private final List<ThemisExpressionInstance> theAnnotations;
45  
46      /**
47       * Constructor.
48       *
49       * @param pParser      the parser
50       * @param pDeclaration the declaration
51       * @throws OceanusException on error
52       */
53      ThemisDeclField(final ThemisParserDef pParser,
54                      final FieldDeclaration pDeclaration) throws OceanusException {
55          super(pParser, pDeclaration);
56          theModifiers = pParser.parseModifierList(pDeclaration.getModifiers());
57          theAnnotations = pParser.parseExprList(pDeclaration.getAnnotations());
58          theVariables = pParser.parseNodeList(pDeclaration.getVariables());
59      }
60  
61      /**
62       * Obtain the modifiers.
63       *
64       * @return the modifiers
65       */
66      public ThemisModifierList getModifiers() {
67          return theModifiers;
68      }
69  
70      /**
71       * Obtain the variables.
72       *
73       * @return the variables
74       */
75      public List<ThemisNodeInstance> getVariables() {
76          return theVariables;
77      }
78  
79      /**
80       * Obtain the annotations.
81       *
82       * @return the annotations
83       */
84      public List<ThemisExpressionInstance> getAnnotations() {
85          return theAnnotations;
86      }
87  }