Skip to content

Package: MethodReference

MethodReference

nameinstructionbranchcomplexitylinemethod
MethodReference(Object, MethodInfo, Annotation[], Object[])
M: 15 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
getAnnotations()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getBase()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getEvaluatedParameters()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getMethodInfo()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * Copyright (c) 2019 Contributors to the Eclipse Foundation
3: *
4: * This program and the accompanying materials are made available under the
5: * terms of the Eclipse Public License v. 2.0, which is available at
6: * http://www.eclipse.org/legal/epl-2.0.
7: *
8: * This Source Code may also be made available under the following Secondary
9: * Licenses when the conditions for such availability set forth in the
10: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11: * version 2 with the GNU Classpath Exception, which is available at
12: * https://www.gnu.org/software/classpath/license.html.
13: *
14: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15: */
16: package jakarta.el;
17:
18: import java.lang.annotation.Annotation;
19:
20: /**
21: * Provides information about the method to which a method expression resolves.
22: */
23: public class MethodReference {
24:
25: private final Object base;
26: private final MethodInfo methodInfo;
27: private final Annotation[] annotations;
28: private final Object[] evaluatedParameters;
29:
30:
31: public MethodReference(Object base, MethodInfo methodInfo, Annotation[] annotations, Object[] evaluatedParameters) {
32: this.base = base;
33: this.methodInfo = methodInfo;
34: this.annotations = annotations;
35: this.evaluatedParameters = evaluatedParameters;
36: }
37:
38:
39: /**
40: * Obtain the base object on which the method will be invoked.
41: *
42: * @return The base object on which the method will be invoked or
43: * {@code null} for literal method expressions.
44: */
45: public Object getBase() {
46: return base;
47: }
48:
49:
50: /**
51: * Obtain the {@link MethodInfo} for the {@link MethodExpression} for which
52: * this {@link MethodReference} has been generated.
53: *
54: * @return The {@link MethodInfo} for the {@link MethodExpression} for which
55: * this {@link MethodReference} has been generated.
56: */
57: public MethodInfo getMethodInfo() {
58: return this.methodInfo;
59: }
60:
61:
62: /**
63: * Obtain the annotations on the method to which the associated expression
64: * resolves.
65: *
66: * @return The annotations on the method to which the associated expression
67: * resolves. If the are no annotations, then an empty array is
68: * returned.
69: */
70: public Annotation[] getAnnotations() {
71: return annotations;
72: }
73:
74:
75: /**
76: * Obtain the evaluated parameter values that will be passed to the method
77: * to which the associated expression resolves.
78: *
79: * @return The evaluated parameters.
80: */
81: public Object[] getEvaluatedParameters() {
82: return evaluatedParameters;
83: }
84: }