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.MethodCallExpr;
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 * MethodCall Expression Declaration.
27 */
28 public class ThemisExprMethodCall
29 extends ThemisBaseExpression<MethodCallExpr> {
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 type.
42 */
43 private final List<ThemisTypeInstance> theTypeParams;
44
45 /**
46 * The pattern.
47 */
48 private final ThemisExpressionInstance theScope;
49
50 /**
51 * The class instance.
52 */
53 private ThemisClassInstance theClassInstance;
54
55 /**
56 * The method instance.
57 */
58 private ThemisMethodInstance theMethodInstance;
59
60 /**
61 * Constructor.
62 *
63 * @param pParser the parser
64 * @param pExpression the expression
65 * @throws OceanusException on error
66 */
67 ThemisExprMethodCall(final ThemisParserDef pParser,
68 final MethodCallExpr pExpression) throws OceanusException {
69 super(pParser, pExpression);
70 theName = pParser.parseNode(pExpression.getName());
71 theArguments = pParser.parseExprList(pExpression.getArguments());
72 theTypeParams = pParser.parseTypeList(pExpression.getTypeArguments().orElse(null));
73 theScope = pParser.parseExpression(pExpression.getScope().orElse(null));
74 }
75
76 /**
77 * Obtain the name.
78 *
79 * @return the name
80 */
81 public ThemisNodeInstance getName() {
82 return theName;
83 }
84
85 /**
86 * Obtain the arguments.
87 *
88 * @return the arguments
89 */
90 public List<ThemisExpressionInstance> getArguments() {
91 return theArguments;
92 }
93
94 /**
95 * Obtain the typeParams.
96 *
97 * @return the typeParams
98 */
99 public List<ThemisTypeInstance> getTypeParams() {
100 return theTypeParams;
101 }
102
103 /**
104 * Obtain the scope.
105 *
106 * @return the scope
107 */
108 public ThemisExpressionInstance getScope() {
109 return theScope;
110 }
111
112 /**
113 * Obtain the class instance.
114 *
115 * @return the class instance
116 */
117 public ThemisClassInstance getClassInstance() {
118 return theClassInstance;
119 }
120
121 /**
122 * Set the class instance.
123 *
124 * @param pClassInstance the class instance
125 */
126 public void setClassInstance(final ThemisClassInstance pClassInstance) {
127 theClassInstance = pClassInstance;
128 }
129
130 /**
131 * Obtain the method instance.
132 *
133 * @return the method instance
134 */
135 public ThemisMethodInstance getMethodInstance() {
136 return theMethodInstance;
137 }
138
139 /**
140 * Set the method instance.
141 *
142 * @param pMethodInstance the method instance
143 */
144 public void setMethodInstance(final ThemisMethodInstance pMethodInstance) {
145 theMethodInstance = pMethodInstance;
146 }
147 }