admin 管理员组

文章数量: 1086019


2024年2月23日发(作者:jsp注释的语法格式)

private Object bindObject(ConfigurationPropertyName name, Bindable target, BindHandler handler, Context context, boolean allowRecursiveBinding) { //

重点

根据名称获取属性值 ConfigurationProperty property = findProperty(name, context); if (property == null && != 0 && containsNoDescendantOf(rces(), name)) { return null; } AggregateBinder aggregateBinder = getAggregateBinder(target, context); if (aggregateBinder != null) { return bindAggregate(name, target, handler, context, aggregateBinder); } if (property != null) { try { return bindProperty(target, context, property); } catch (ConverterNotFoundException ex) { // We might still be able to bind it using the recursive binders Object instance = bindDataObject(name, target, handler, context, allowRecursiveBinding); if (instance != null) { return instance; } throw ex; } } return bindDataObject(name, target, handler, context, allowRecursiveBinding); }anBinder源码/* * Copyright 2012-2020 the original author or authors. * * Licensed 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 * * /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 ;import pector;import tion;import ;import ;import er;import ;import ator;import HashMap;import ;import umer;import on;import er;import ils;import t;import urationPropertyName;import urationPropertySource;import urationPropertyState;import Parameter;import ableType;

import ableType;/** * {@link DataObjectBinder} for mutable Java Beans. * * @author Phillip Webb * @author Madhura Bhave */class JavaBeanBinder implements DataObjectBinder { static final JavaBeanBinder INSTANCE = new JavaBeanBinder(); @Override public T bind(ConfigurationPropertyName name, Bindable target, Context context, DataObjectPropertyBinder propertyBinder) { boolean hasKnownBindableProperties = ue() != null && hasKnownBindableProperties(name, context); Bean bean = (target, hasKnownBindableProperties); if (bean == null) { return null; } BeanSupplier beanSupplier = plier(target); boolean bound = bind(propertyBinder, bean, beanSupplier, context); return (bound ? () : null); } @Override @SuppressWarnings("unchecked") public T create(Bindable target, Context context) { Class type = (Class) e().resolve(); return (type != null) ? tiateClass(type) : null; } private boolean hasKnownBindableProperties(ConfigurationPropertyName name, Context context) { for (ConfigurationPropertySource source : rces()) { if (nsDescendantOf(name) == T) { return true; } } return false; } private boolean bind(DataObjectPropertyBinder propertyBinder, Bean bean, BeanSupplier beanSupplier, Context context) { boolean bound = false; for (BeanProperty beanProperty : perties().values()) { bound |= bind(beanSupplier, propertyBinder, beanProperty); onfigurationProperty(); } return bound; } private boolean bind(BeanSupplier beanSupplier, DataObjectPropertyBinder propertyBinder, BeanProperty property) { String propertyName = e(); ResolvableType type = e(); Supplier value = ue(beanSupplier); Annotation[] annotations = otations(); Object bound = operty(propertyName, (type).withSuppliedValue(value).withAnnotations(annotations)); if (bound == null) { return false; } if (able()) { ue(beanSupplier, bound); } else if (value == null || !(())) { throw new IllegalStateException("No setter found for property: " + e());

throw new IllegalStateException("No setter found for property: " + e()); } return true; } /** * The bean being bound. * * @param the bean type */ static class Bean { private static Bean cached; private final ResolvableType type; private final Class resolvedType; private final Map properties = new LinkedHashMap<>(); Bean(ResolvableType type, Class resolvedType) { = type; edType = resolvedType; addProperties(resolvedType); } private void addProperties(Class type) { while (type != null && !(type)) { Method[] declaredMethods = getSorted(type, Class::getDeclaredMethods, Method::getName); Field[] declaredFields = getSorted(type, Class::getDeclaredFields, Field::getName); addProperties(declaredMethods, declaredFields); type = erclass(); } } private E[] getSorted(S source, Function elements, Function name) { E[] result = (source); (result, ing(name)); return result; } protected void addProperties(Method[] declaredMethods, Field[] declaredFields) { for (int i = 0; i < ; i++) { if (!isCandidate(declaredMethods[i])) { declaredMethods[i] = null; } } for (Method method : declaredMethods) { addMethodIfPossible(method, "get", 0, BeanProperty::addGetter); addMethodIfPossible(method, "is", 0, BeanProperty::addGetter); } for (Method method : declaredMethods) { addMethodIfPossible(method, "set", 1, BeanProperty::addSetter); } for (Field field : declaredFields) { addField(field); } } private boolean isCandidate(Method method) { int modifiers = ifiers(); return !ate(modifiers) && !ected(modifiers) && !ract(modifiers) && !ic(modifiers) && !(laringClass()) && !(laringClass()) && e().indexOf('$') == -1; } private void addMethodIfPossible(Method method, String prefix, int parameterCount,

private void addMethodIfPossible(Method method, String prefix, int parameterCount, BiConsumer consumer) { if (method != null && ameterCount() == parameterCount && e().startsWith(prefix) && e().length() > ()) { String propertyName = talize(e().substring(())); (eIfAbsent(propertyName, this::getBeanProperty), method); } } private BeanProperty getBeanProperty(String name) { return new BeanProperty(name, ); } private void addField(Field field) { BeanProperty property = (e()); if (property != null) { ld(field); } } Map getProperties() { return ties; } @SuppressWarnings("unchecked") BeanSupplier getSupplier(Bindable target) { return new BeanSupplier<>(() -> { T instance = null; if (ue() != null) { instance = ue().get(); } if (instance == null) { instance = (T) tiateClass(edType); } return instance; }); } @SuppressWarnings("unchecked") static Bean get(Bindable bindable, boolean canCallGetValue) { ResolvableType type = e(); Class resolvedType = e(); Supplier value = ue(); T instance = null; if (canCallGetValue && value != null) { instance = (); resolvedType = (instance != null) ? ss() : resolvedType; } if (instance == null && !isInstantiable(resolvedType)) { return null; } Bean bean = ; if (bean == null || !pe(type, resolvedType)) { bean = new Bean<>(type, resolvedType); cached = bean; } return (Bean) bean; } private static boolean isInstantiable(Class type) { if (rface()) { return false; } try { laredConstructor(); return true;

= setter; } } private boolean isBetterSetter(Method setter) { return != null && urnType().equals(ameterTypes()[0]); } void addField(Field field) { if ( == null) { = field; } } String getName() { return ; } ResolvableType getType() { if ( != null) { MethodParameter methodParameter = new MethodParameter(, 0); return hodParameter(methodParameter, ingClassType); } MethodParameter methodParameter = new MethodParameter(, -1); return hodParameter(methodParameter, ingClassType); } Annotation[] getAnnotations() { try { return ( != null) ? laredAnnotations() : null; } catch (Exception ex) { return null; } } Supplier getValue(Supplier instance) { if ( == null) { return null; } return () -> { try { essible(true); return (()); } catch (Exception ex) { throw new IllegalStateException("Unable to get value for property " + , ex); } }; } boolean isSettable() { return != null; } void setValue(Supplier instance, Object value) { try { essible(true); ((), value); } catch (Exception ex) { throw new IllegalStateException("Unable to set value for property " + , ex); } } }

/* * Copyright 2012-2020 the original author or authors. * * Licensed 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 * * /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 ;/** * Internal utility to help when dealing with data object property names. * * @author Phillip Webb * @author Madhura Bhave * @since 2.2.3 * @see DataObjectBinder */public abstract class DataObjectPropertyName { private DataObjectPropertyName() { } /** * Return the specified Java Bean property name in dashed form. * @param name the source name * @return the dashed from */ public static String toDashedForm(String name) { StringBuilder result = new StringBuilder(()); boolean inIndex = false; for (int i = 0; i < (); i++) { char ch = (i); if (inIndex) { (ch); if (ch == ']') { inIndex = false; } } else { if (ch == '[') { inIndex = true; (ch); } else { ch = (ch != '_') ? ch : '-'; if (rCase(ch) && () > 0 && (() - 1) != '-') { ('-'); } (rCase(ch)); } } } return ng(); }}


本文标签: 注释 获取 属性 名称

更多相关文章

win10系统计算机名称查看及重命名操作方法

4月前

win10系统计算机名称查看及重命名操作方法 一、在 Windows 10 操作系统中查看计算机的名称步骤二、重命名计算机名称 一、在 Windows 10 操作系统中查看计算机的名称步骤 点击桌面左下角的“开始”按钮&#xff0

Win7文件夹属性没有位置选项怎么解决

4月前

我们在使用电脑的时候&#xff0c;经常会对文件夹的属性进行设置&#xff0c;但是最近不少用户在使用电脑查看的win7系统文件夹属性的时候&#xff0c;发现位置属性不见了&#xff0c;那么Win7文件夹

Windows程序设计:调用API获取当前系统正在运行的进程名称及ID

4月前

0x00 前言 文章中的文字可能存在语法错误以及标点错误&#xff0c;请谅解&#xff1b; 如果在文章中发现代码错误或其它问题请告知&#xff0c;感谢&#xff01; 本例运行系统环境为windo

表驱动法(TableDrivenApproach)

4月前

年月日发(作者:属性方法)&#;&#;,&#;&#;,&#;&#;,&#;&#;,&#;&#;,&#;&#;,&#;&#;,&#;&#;};([]){[][*];(;;){[];[*][];[*][&];}();}(){[]{,,,,,,}

VirtualBox + Centos全屏设置

3月前

年月日发(作者:注释自动缩进问题)全屏设置一、检查以下模块是否安装()-()-()二、如果没有安装,请使用如下命令:--这条命令的执行必须是以系统管理员的账号登录。三、安装完成后重新启动系统()四、安装增强功能,如图图如果安装失败,请查看日

除去桌面阴影的几个方法

3月前

年月日发(作者:怎么导入项目英文版)除去桌面阴影的几个方法--:.我在桌面属性-外观-效果-在菜单下显示阴影.桌面空白处右键,排列图标,取消"在桌面上锁定项目"的小勾.我的电脑--右点--属性--高级--性能--设置--自定义---桌面图标

string类型的json解析事例

3月前

年月日发(作者:边框)类型的解析事例下载提示:该文档是本店铺精心编制而成的,希望大家下载后,能够帮助大家解决实际问题。文档下载后可定制修改,请根据实际需要进行调整和使用,谢谢!本店铺为大家提供各种类型的实用资料,如教育随笔、日记赏析、句子摘

Json解析工具Jackson(使用注解)

3月前

年月日发(作者:用户登录界面)解析工具(使用注解)•@此注解是类注解,作用是序列化时将中的一些属性忽略掉,序列化和反序列化都受影响。•@此注解用于属性或者方法上(最好是属性上),作用和上面的@一样。•@此注解用于属性或者方法上(最好是属性上

orcale11g的标准卸载

3月前

年月日发(作者:):停止服务列表中的相关服务;:程序——___——----删除:删除注册表:删除环境变量:右击“我的电脑”,属性——系统属性-——高级-——环境变量。删除上图两个大框中的与相关的选项。:重启计算机。

批处理命令删除文件,重命名文件

3月前

年月日发(作者:构造哈夫曼树静态三叉链表)批处理命令删除文件,重命名文件@%为路径参数;:数据库-勿删删除文件:数据库-勿删重命名文件%%一、删除文件、自动删除文件批处理::将直接删除:,没有任务提示、自动删除目录空:?:将直接删除:目录,

C语言程序设计 –第 01 章课后习题

3月前

年月日发(作者:是什么意思)年程序设计序设计设计––第一章一章课后章课后习语言程序语言程语言言程序设第一第一章课课后习题后习题习题子择题一、、选择选择题以下叙述下叙述不正.以下叙.以下述不正确不正确的正确的是的是(()一个可以由一以由一个个

2初识VB程序设计教案

3月前

年月日发(作者:专业电机生产厂商)算法与程序设计·初识程序设计第页,共页初识程序设计一、基本说明模块:算法与程序设计年级:高中二年级所用教材版本:教育科学出版社所属章节:第二章学时数:分钟二、教学设计、教学目标:知识、技能目标:了解程序设计

C#程序设计语言复习题(试题及答案版)

3月前

年月日发(作者:表格函数)一.填空题.#源程序的后缀名为______.________。.#中每个类型的变量占用_______个字节的内存。.#的每行语句以________分号_______结尾。.布尔型的变量可以赋值为关键字_______

计算机如何配置桌面显示属性,WindowsXP显示属性的设置教程

2月前

WindowsXP显示属性的设置教程 计算机属性系配置信息显示不出来怎么解决,以下是小编跟大家介绍WindowsXP显示属性的设置教程&#xff0c;欢迎大家阅读! 显示属性的设置 Windows桌面的背景、屏幕外观、屏幕保护等&a

kali扫描不到wifi_kali学习笔记之——利用kali获取隐藏SSID名称

2月前

最近跟着公司的大牛学习安全审计,之所以写这篇文章,一是为了与在圈子里的同学共同学习,二是做一个记录,俗话说温故而知新,可以为师矣。 总所周知,现在的路由器都支持隐藏SSID功能,即隐藏自己的WIFI名称,在手机上和电脑上无法搜索到你的WIF

1.ensp给计算机和路由器配置IP地址,更改路由器的时钟和名称

2月前

首先对一个网络做出如下规划 两台计算机分别在一个网段&#xff0c;PC1在192.168.0.024网段&#xff0c;PC2在192.168.2.024网段。两台路由器相连的接口在192.168.1.024网段。

linux系统报错误0x800f080c,windows-server-2016 – 功能名称Microsoft-Windows-Subsystem-Linux未知...

1月前

我试图按照这些说明 https:docs.microsoften-uswindowswslinstall-on-server在AWS EC2上的Windows Server 2016上启用linux子系统 这是错误消息&

金蝶账套总显示找不到服务器,金蝶KIS账套名称登录时没有显示怎么办呢

1月前

金蝶KIS账套名称登录时没有显示怎么办呢以下文字资料是由(历史新知网www.lishixinzhi)小编为大家搜集整理后发布的内容&#xff0c;让我们赶快一起来看一下吧&#xff01; 金蝶KIS账套名称登录时没有显示怎么

css属性值无效,属性在浏览器控制台以黄色感叹号显示怎么办?

17天前

css属性值无效 &#xff0c;属性在浏览器控制台以黄色感叹号怎么办&#xff1f; 遇到这种情况大多数是由于属性的大小写不规范导致的 比如在标签中直接写样式&#xff0c;那么一般是驼峰命名属性值,如下 <

双击计算机文档,电脑双击文件都是打开属性窗口怎么办

17天前

电脑双击文件都是打开属性窗口怎么办 电脑双击文件都是打开属性窗口怎么办?不知道电脑怎么回事&#xff0c;双击文件后显示的都是属性窗口&#xff0c;该怎么办呢?下面小编分享电脑鼠标双击文件都是打开属性窗口的解决办法&

发表评论

全部评论 0
暂无评论