本文整理匯總了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