private PropertyEditor findSpringConvertingPropertyEditor(String field, Class<?> valueType) { if (conversionService != null) { String converterId = null; if (field != null) { if (binderConfiguration != null) { converterId = binderConfiguration.getConverterId(field); } if (valueType == null) { valueType = parseFieldExpression(field, false).getValueType(boundObject); } } if (valueType != null) { BeanWrapper accessor = PropertyAccessorFactory.forBeanPropertyAccess(boundObject); TypeDescriptor typeDescriptor = accessor.getPropertyTypeDescriptor(field); return new ConvertingPropertyEditorAdapter(conversionService, converterId, typeDescriptor); } else { return null; } } else { return null; } }
/** * {@inheritDoc} */ @Override public TypeDescriptor getPropertyTypeDescriptor(String propertyName) throws BeansException { return wrapper.getPropertyTypeDescriptor(propertyName); }
.getPropertyTypeDescriptor(fieldNameToFindType);
.getPropertyTypeDescriptor(fieldNameToFindType);
TypeDescriptor sourceType; if (beanWrapper != null) { sourceType = beanWrapper.getPropertyTypeDescriptor(name); } else { sourceType = TypeDescriptor.forObject(value);
private static <T> String convertToString(final List<T> actualRowValues, final List<String> propertiesToCompare) { final List<List<Object>> rawRows = new ArrayList<>(); rawRows.add(propertiesToCompare.stream().collect(Collectors.toList())); for (final T actualRow : actualRowValues) { final BeanWrapper src = new BeanWrapperImpl(actualRow); rawRows.add(propertiesToCompare.stream().map(p -> { final Object propertyValue = src.getPropertyValue(p); if (propertyValue == null) { return ""; } else if (src.getPropertyTypeDescriptor(p).getObjectType().isAssignableFrom(BigDecimal.class)) { return ((BigDecimal) propertyValue).stripTrailingZeros().toPlainString(); } return propertyValue; }).collect(Collectors.toList())); } return DataTable.create(rawRows).toString(); }
private void extendCollectionIfNecessary(BeanWrapper wrapper, BeanPath path, int index) { String name = path.prefix(index); TypeDescriptor elementDescriptor = wrapper.getPropertyTypeDescriptor(name) .getElementTypeDescriptor(); if (!elementDescriptor.isMap() && !elementDescriptor.isCollection() && !elementDescriptor.getType().equals(Object.class)) { return; } Object extend = new LinkedHashMap<String, Object>(); if (!elementDescriptor.isMap() && path.isArrayIndex(index)) { extend = new ArrayList<>(); } wrapper.setPropertyValue(path.prefix(index + 1), extend); }
Object oValue = beanWrapper.getPropertyValue(objectKey); if(oValue != null) { fieldValue = play.data.format.Formatters.print(beanWrapper.getPropertyTypeDescriptor(objectKey), oValue); beanWrapper.setAutoGrowNestedPaths(true); try { for(Annotation a: beanWrapper.getPropertyTypeDescriptor(key).getAnnotations()) { Class<?> annotationType = a.annotationType(); if(annotationType.isAnnotationPresent(play.data.Form.Display.class)) {
if (formatters != null) { final String objectKeyFinal = objectKey; fieldValue = withRequestLocale(lang, () -> formatters.print(beanWrapper.getPropertyTypeDescriptor(objectKeyFinal), oValue)); } else { fieldValue = oValue.toString(); beanWrapper.setAutoGrowNestedPaths(true); try { for (Annotation a: beanWrapper.getPropertyTypeDescriptor(key).getAnnotations()) { Class<?> annotationType = a.annotationType(); if (annotationType.isAnnotationPresent(play.data.Form.Display.class)) {
Object oValue = beanWrapper.getPropertyValue(objectKey); if(oValue != null) { fieldValue = play.data.format.Formatters.print(beanWrapper.getPropertyTypeDescriptor(objectKey), oValue); beanWrapper.setAutoGrowNestedPaths(true); try { for(Annotation a: beanWrapper.getPropertyTypeDescriptor(key).getAnnotations()) { Class<?> annotationType = a.annotationType(); if(annotationType.isAnnotationPresent(play.data.Form.Display.class)) {
if (formatters != null) { final String objectKeyFinal = objectKey; fieldValue = withRequestLocale(lang, () -> formatters.print(beanWrapper.getPropertyTypeDescriptor(objectKeyFinal), oValue)); } else { fieldValue = oValue.toString(); beanWrapper.setAutoGrowNestedPaths(true); try { for (Annotation a: beanWrapper.getPropertyTypeDescriptor(key).getAnnotations()) { Class<?> annotationType = a.annotationType(); if (annotationType.isAnnotationPresent(play.data.Form.Display.class)) {
if (formatters != null) { final String objectKeyFinal = objectKey; fieldValue = withRequestLocale(lang, () -> formatters.print(beanWrapper.getPropertyTypeDescriptor(objectKeyFinal), oValue)); } else { fieldValue = oValue.toString(); beanWrapper.setAutoGrowNestedPaths(true); try { for (Annotation a: beanWrapper.getPropertyTypeDescriptor(key).getAnnotations()) { Class<?> annotationType = a.annotationType(); if (annotationType.isAnnotationPresent(play.data.Form.Display.class)) {
TypeDescriptor sourceType = beanWrapper.getPropertyTypeDescriptor( name);
private PropertyEditor findSpringConvertingPropertyEditor(String field, Class<?> valueType) { if (conversionService != null) { String converterId = null; if (field != null) { if (binderConfiguration != null) { converterId = binderConfiguration.getConverterId(field); } if (valueType == null) { valueType = parseFieldExpression(field, false).getValueType(boundObject); } } if (valueType != null) { BeanWrapper accessor = PropertyAccessorFactory.forBeanPropertyAccess(boundObject); TypeDescriptor typeDescriptor = accessor.getPropertyTypeDescriptor(field); return new ConvertingPropertyEditorAdapter(conversionService, converterId, typeDescriptor); } else { return null; } } else { return null; } }
private void extendMapIfNecessary(BeanWrapper wrapper, BeanPath path, int index) { String name = path.prefix(index); TypeDescriptor parent = wrapper.getPropertyTypeDescriptor(name); if (parent == null) { return;
target.getPropertyTypeDescriptor(propertyName));
TypeDescriptor descriptor = wrapper.getPropertyTypeDescriptor(name); if (descriptor == null || descriptor.isMap()) { if (isMapValueStringType(descriptor)