ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/jakarta/el/BeanNameELResolver.java

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/jakarta/el/BeanNameELResolver.java
Status
scanned
Type
file
Name
BeanNameELResolver.java
Extension
.java
Programming language
Java
Mime type
text/plain
File type
ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
4801 (4.7 KB)
MD5
374033cdebbaaa3c6fb4135f20cf5ce8
SHA1
da90254a44d515deff37967453409f31ff012bdd
SHA256
45a931df18cd9d7c9689cffcbf03e638a0713bafd19c37edd7b78cf8c6218660
SHA512

      
    
SHA1_git
4ccbda141eb7d250cfcb2816c97ac1e89e036c6a
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
BeanNameELResolver.java | 4.7 KB |

/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package jakarta.el; import java.util.Objects; /** * @since EL 3.0 */ public class BeanNameELResolver extends ELResolver { private final BeanNameResolver beanNameResolver; public BeanNameELResolver(BeanNameResolver beanNameResolver) { this.beanNameResolver = beanNameResolver; } @Override public Object getValue(ELContext context, Object base, Object property) { Objects.requireNonNull(context); if (base != null || !(property instanceof String beanName)) { return null; } if (beanNameResolver.isNameResolved(beanName)) { try { Object result = beanNameResolver.getBean(beanName); context.setPropertyResolved(null, property); return result; } catch (Throwable t) { Util.handleThrowable(t); throw new ELException(t); } } return null; } @Override public void setValue(ELContext context, Object base, Object property, Object value) { Objects.requireNonNull(context); if (base != null || !(property instanceof String beanName)) { return; } boolean isResolved = context.isPropertyResolved(); boolean isReadOnly; try { isReadOnly = isReadOnly(context, null, property); } catch (Throwable t) { Util.handleThrowable(t); throw new ELException(t); } finally { context.setPropertyResolved(isResolved); } if (isReadOnly) { throw new PropertyNotWritableException(Util.message(context, "beanNameELResolver.beanReadOnly", beanName)); } if (beanNameResolver.isNameResolved(beanName) || beanNameResolver.canCreateBean(beanName)) { try { beanNameResolver.setBeanValue(beanName, value); context.setPropertyResolved(null, property); } catch (Throwable t) { Util.handleThrowable(t); throw new ELException(t); } } } @Override public Class<?> getType(ELContext context, Object base, Object property) { Objects.requireNonNull(context); if (base != null || !(property instanceof String beanName)) { return null; } try { if (beanNameResolver.isNameResolved(beanName)) { Class<?> result = beanNameResolver.getBean(beanName).getClass(); context.setPropertyResolved(null, property); /* * No resolver level isReadOnly property for this resolver */ if (beanNameResolver.isReadOnly((String) property)) { return null; } return result; } } catch (Throwable t) { Util.handleThrowable(t); throw new ELException(t); } return null; } @Override public boolean isReadOnly(ELContext context, Object base, Object property) { Objects.requireNonNull(context); if (base != null || !(property instanceof String beanName)) { // Return value undefined return false; } if (beanNameResolver.isNameResolved(beanName)) { boolean result; try { result = beanNameResolver.isReadOnly(beanName); } catch (Throwable t) { Util.handleThrowable(t); throw new ELException(t); } context.setPropertyResolved(null, property); return result; } // Return value undefined return false; } @Override public Class<?> getCommonPropertyType(ELContext context, Object base) { return String.class; } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
28.95
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-4bde3f57-78aa-4201-96bf-531cba09e7de apache-2.0 Apache-2.0
URL Start line End line
http://www.apache.org/licenses/LICENSE-2.0 9 9