本文整理汇总了Java中org.springframework.beans.BeanWrapper.isReadableProperty方法的典型用法代码示例。如果您正苦于以下问题:Java BeanWrapper.isReadableProperty方法的具体用法?Java BeanWrapper.isReadableProperty怎么用?Java BeanWrapper.isReadableProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.beans.BeanWrapper
的用法示例。
在下文中一共展示了BeanWrapper.isReadableProperty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getModelFieldSpec
import org.springframework.beans.BeanWrapper; //导入方法依赖的package包/类
/**
* 计算实体字段规范
*/
public static <MODEL extends BaseMybatisModel> List<MybatisModelFieldSpec> getModelFieldSpec(
Class<MODEL> clazz) {
if (modelFieldSpec.containsKey(clazz.getName())) {
return modelFieldSpec.get(clazz.getName());
} else {
List<MybatisModelFieldSpec> modelFieldSpecs = new ArrayList<MybatisModelFieldSpec>();
BeanWrapper beanWrapper = new BeanWrapperImpl(clazz);
for (PropertyDescriptor propertyDescriptor : beanWrapper.getPropertyDescriptors()) {
if (beanWrapper
.isReadableProperty(propertyDescriptor.getName())
&& propertyDescriptor.getReadMethod()
.isAnnotationPresent(Column.class)) {
Column column = propertyDescriptor.getReadMethod()
.getAnnotation(Column.class);
String javaType = propertyDescriptor.getPropertyType()
.getSimpleName();
modelFieldSpecs.add(new MybatisModelFieldSpec(
column.name(),
propertyDescriptor.getName(),
javaType,
MybatisType.javaTypeMap.get(javaType)));
}
}
modelFieldSpec.put(clazz.getName(), modelFieldSpecs);
return modelFieldSpecs;
}
}
示例2: isBlanked
import org.springframework.beans.BeanWrapper; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
private boolean isBlanked(BeanWrapper wrapper, String propertyName, String key) {
Object value = (wrapper.isReadableProperty(propertyName)
? wrapper.getPropertyValue(propertyName) : null);
if (value instanceof Map) {
if (((Map) value).get(key) == BLANK) {
return true;
}
}
return false;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:RelaxedDataBinder.java
示例3: extendMapIfNecessary
import org.springframework.beans.BeanWrapper; //导入方法依赖的package包/类
private void extendMapIfNecessary(BeanWrapper wrapper, BeanPath path, int index) {
String name = path.prefix(index);
TypeDescriptor parent = wrapper.getPropertyTypeDescriptor(name);
if (parent == null) {
return;
}
TypeDescriptor descriptor = parent.getMapValueTypeDescriptor();
if (descriptor == null) {
descriptor = TypeDescriptor.valueOf(Object.class);
}
if (!descriptor.isMap() && !descriptor.isCollection()
&& !descriptor.getType().equals(Object.class)) {
return;
}
String extensionName = path.prefix(index + 1);
if (wrapper.isReadableProperty(extensionName)) {
Object currentValue = wrapper.getPropertyValue(extensionName);
if ((descriptor.isCollection() && currentValue instanceof Collection)
|| (!descriptor.isCollection() && currentValue instanceof Map)) {
return;
}
}
Object extend = new LinkedHashMap<String, Object>();
if (descriptor.isCollection()) {
extend = new ArrayList<Object>();
}
if (descriptor.getType().equals(Object.class) && path.isLastNode(index)) {
extend = BLANK;
}
wrapper.setPropertyValue(extensionName, extend);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:32,代码来源:RelaxedDataBinder.java
示例4: getDeepPropertyIfExists
import org.springframework.beans.BeanWrapper; //导入方法依赖的package包/类
public static synchronized Object getDeepPropertyIfExists(BeanWrapper wrapper, String property) {
if (wrapper.isReadableProperty(property)) {
return wrapper.getPropertyValue(property);
} else {
return null;
}
}
示例5: processPojo
import org.springframework.beans.BeanWrapper; //导入方法依赖的package包/类
private void processPojo(String counterName, Object payload) {
BeanWrapper beanWrapper = new BeanWrapperImpl(payload);
if (beanWrapper.isReadableProperty(fvcSinkProperties.getFieldName())) {
Object value = beanWrapper.getPropertyValue(fvcSinkProperties.getFieldName());
processValue(counterName, value);
}
}
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-starters,代码行数:8,代码来源:FieldValueCounterSinkConfiguration.java
示例6: processPojo
import org.springframework.beans.BeanWrapper; //导入方法依赖的package包/类
private void processPojo(String counterName, Object payload) {
String fieldName = this.fvcSinkProperties.getFieldName();
Object value = null;
if (payload instanceof Map) {
Map map = (Map) payload;
if (map.containsKey(fieldName)) {
value = map.get(fieldName);
}
else {
log.error("The property '" + fieldName + "' is not available in the payload: " + payload);
}
}
else {
BeanWrapper beanWrapper = new BeanWrapperImpl(payload);
if (beanWrapper.isReadableProperty(fieldName)) {
value = beanWrapper.getPropertyValue(fieldName);
}
else {
log.error("The property '" + fieldName + "' is not available in the payload: " + payload);
}
}
if (value != null) {
processValue(counterName, value);
}
else {
log.info("The value for the property '" + fieldName + "' in the payload '" + payload + "' is null. Ignored");
}
}
开发者ID:spring-cloud-stream-app-starters,项目名称:field-value-counter,代码行数:32,代码来源:FieldValueCounterSinkConfiguration.java