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.MethodReferenceExpr;
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 * Method Reference Expression Declaration.
27 */
28 public class ThemisExprMethodRef
29 extends ThemisBaseExpression<MethodReferenceExpr> {
30 /**
31 * The name.
32 */
33 private final String theName;
34
35 /**
36 * The scope.
37 */
38 private final ThemisExpressionInstance theScope;
39
40 /**
41 * The typeArguments.
42 */
43 private final List<ThemisTypeInstance> theTypeArgs;
44
45 /**
46 * Constructor.
47 *
48 * @param pParser the parser
49 * @param pExpression the expression
50 * @throws OceanusException on error
51 */
52 ThemisExprMethodRef(final ThemisParserDef pParser,
53 final MethodReferenceExpr pExpression) throws OceanusException {
54 super(pParser, pExpression);
55 theName = pExpression.getIdentifier();
56 theScope = pParser.parseExpression(pExpression.getScope());
57 theTypeArgs = pParser.parseTypeList(pExpression.getTypeArguments().orElse(null));
58 }
59
60 /**
61 * Obtain the Name.
62 *
63 * @return the name
64 */
65 public String getName() {
66 return theName;
67 }
68
69 /**
70 * Obtain the Scope.
71 *
72 * @return the scope
73 */
74 public ThemisExpressionInstance getScope() {
75 return theScope;
76 }
77
78 /**
79 * Obtain the TypeArguments.
80 *
81 * @return the typeArgs
82 */
83 public List<ThemisTypeInstance> getTypeArgs() {
84 return theTypeArgs;
85 }
86 }