Skip to content

Package: BeanNameResolver

BeanNameResolver

nameinstructionbranchcomplexitylinemethod
BeanNameResolver()
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%
canCreateBean(String)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getBean(String)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
isNameResolved(String)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
isReadOnly(String)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
setBeanValue(String, Object)
M: 4 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) 2012, 2019 Oracle and/or its affiliates and others.
3: * All rights reserved.
4: *
5: * This program and the accompanying materials are made available under the
6: * terms of the Eclipse Public License v. 2.0, which is available at
7: * http://www.eclipse.org/legal/epl-2.0.
8: *
9: * This Source Code may also be made available under the following Secondary
10: * Licenses when the conditions for such availability set forth in the
11: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
12: * version 2 with the GNU Classpath Exception, which is available at
13: * https://www.gnu.org/software/classpath/license.html.
14: *
15: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16: */
17:
18: package jakarta.el;
19:
20: /**
21: * Resolves a bean by its known name. This class can be extended to return a bean object given its name, to set a value
22: * to an existing bean, or to create a bean with the value.
23: *
24: * @see BeanNameELResolver
25: *
26: * @since Jakarta Expression Language 3.0
27: */
28: public abstract class BeanNameResolver {
29:
30: /**
31: * Returns whether the given name is resolved by the BeanNameResolver
32: *
33: * @param beanName The name of the bean.
34: * @return true if the name is resolved by this BeanNameResolver; false otherwise.
35: */
36: public boolean isNameResolved(String beanName) {
37: return false;
38: }
39:
40: /**
41: * Returns the bean known by its name.
42: *
43: * @param beanName The name of the bean.
44: * @return The bean with the given name. Can be <code>null</code>.
45: *
46: */
47: public Object getBean(String beanName) {
48: return null;
49: }
50:
51: /**
52: * Sets a value to a bean of the given name. If the bean of the given name does not exist and if {@link #canCreateBean}
53: * is <code>true</code>, one is created with the given value.
54: *
55: * @param beanName The name of the bean
56: * @param value The value to set the bean to. Can be <code>null</code>.
57: * @throws PropertyNotWritableException if the bean cannot be modified or created.
58: */
59: public void setBeanValue(String beanName, Object value) throws PropertyNotWritableException {
60: throw new PropertyNotWritableException();
61: }
62:
63: /**
64: * Indicates if the bean of the given name is read-only or writable
65: *
66: * @param beanName The name of the bean
67: * @return <code>true</code> if the bean can be set to a new value. <code>false</code> otherwise.
68: */
69: public boolean isReadOnly(String beanName) {
70: return true;
71: }
72:
73: /**
74: * Allow creating a bean of the given name if it does not exist.
75: *
76: * @param beanName The name of the bean
77: * @return <code>true</code> if bean creation is supported <code>false</code> otherwise.
78: */
79: public boolean canCreateBean(String beanName) {
80: return false;
81: }
82: }