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.expr;
18  
19  import com.github.javaparser.ast.expr.FieldAccessExpr;
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   * FieldAccess Expression Declaration.
27   */
28  public class ThemisExprFieldAccess
29          extends ThemisBaseExpression<FieldAccessExpr> {
30      /**
31       * The name.
32       */
33      private final ThemisNodeInstance theName;
34  
35      /**
36       * The scope.
37       */
38      private final ThemisExpressionInstance theScope;
39  
40      /**
41       * The expression.
42       */
43      private final List<ThemisTypeInstance> theTypes;
44  
45  
46      /**
47       * Constructor.
48       *
49       * @param pParser     the parser
50       * @param pExpression the expression
51       */
52      ThemisExprFieldAccess(final ThemisParserDef pParser,
53                            final FieldAccessExpr pExpression) throws OceanusException {
54          super(pParser, pExpression);
55          theName = pParser.parseNode(pExpression.getName());
56          theScope = pParser.parseExpression(pExpression.getScope());
57          theTypes = pParser.parseTypeList(pExpression.getTypeArguments().orElse(null));
58      }
59  
60  
61      /**
62       * Obtain the Name.
63       *
64       * @return the name
65       */
66      public ThemisNodeInstance getName() {
67          return theName;
68      }
69  
70      /**
71       * Obtain the scope.
72       *
73       * @return the scope
74       */
75      public ThemisExpressionInstance getScope() {
76          return theScope;
77      }
78  
79      /**
80       * Obtain the types.
81       *
82       * @return the types
83       */
84      public List<ThemisTypeInstance> getTypes() {
85          return theTypes;
86      }
87  }