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.EnumConstantDeclaration;
20  import io.github.tonywasher.joceanus.oceanus.base.OceanusException;
21  import io.github.tonywasher.joceanus.themis.parser.base.ThemisParserDef;
22  
23  import java.util.List;
24  
25  /**
26   * Class Declaration.
27   */
28  public class ThemisDeclEnumValue
29          extends ThemisBaseDeclaration<EnumConstantDeclaration> {
30      /**
31       * The name.
32       */
33      private final ThemisNodeInstance theName;
34  
35      /**
36       * The arguments.
37       */
38      private final List<ThemisExpressionInstance> theArguments;
39  
40      /**
41       * The class body.
42       */
43      private final List<ThemisDeclarationInstance> theBody;
44  
45      /**
46       * The annotations.
47       */
48      private final List<ThemisExpressionInstance> theAnnotations;
49  
50      /**
51       * Constructor.
52       *
53       * @param pParser      the parser
54       * @param pDeclaration the declaration
55       */
56      ThemisDeclEnumValue(final ThemisParserDef pParser,
57                          final EnumConstantDeclaration pDeclaration) throws OceanusException {
58          super(pParser, pDeclaration);
59          theName = pParser.parseNode(pDeclaration.getName());
60          theAnnotations = pParser.parseExprList(pDeclaration.getAnnotations());
61          theArguments = pParser.parseExprList(pDeclaration.getArguments());
62          theBody = pParser.parseDeclarationList(pDeclaration.getClassBody());
63      }
64  
65      /**
66       * Obtain the name.
67       *
68       * @return the name
69       */
70      public ThemisNodeInstance getName() {
71          return theName;
72      }
73  
74      /**
75       * Obtain the arguments.
76       *
77       * @return the arguments
78       */
79      public List<ThemisExpressionInstance> getArguments() {
80          return theArguments;
81      }
82  
83      /**
84       * Obtain the body.
85       *
86       * @return the body
87       */
88      public List<ThemisDeclarationInstance> getBody() {
89          return theBody;
90      }
91  
92      /**
93       * Obtain the annotations.
94       *
95       * @return the annotations
96       */
97      public List<ThemisExpressionInstance> getAnnotations() {
98          return theAnnotations;
99      }
100 }