@Test public void getUnconvertedValueToJavaMapsFields() { HashMap<String, Object> fieldMap = new HashMap<String, Object>(); fieldMap.put("sapField1", Integer.MAX_VALUE); fieldMap.put("sapField2", Float.MAX_VALUE); Object value = structureMapping.getUnconvertedValueToJava(fieldMap, converterCache); assertThat(value).isInstanceOf(TestStructureBean.class); TestStructureBean bean = (TestStructureBean) value; assertThat(bean.javaField1).isEqualTo(Integer.MAX_VALUE); assertThat(bean.javaField2).isEqualTo(Float.MAX_VALUE); }
@Override protected Object getUnconvertedValueToJava(final Object fieldMap, final ConverterCache converterCache) { Map<String, Object> subMap = UnsafeCastHelper.castToMap(fieldMap); Object subBean = ReflectionHelper.newInstance(getAssociatedType()); for (ParameterMapping parameter : parameters) { Object fieldValue = subMap.get(parameter.getSapName()); if (fieldValue != null) { Object value = parameter.mapToJava(fieldValue, converterCache); ReflectionHelper.setFieldValue(subBean, parameter.getJavaName(), value); } } return subBean; }
StructureMapping extends ParameterMapping { @Override protected Object getUnconvertedValueToJava(final Object fieldMap, final ConverterCache converterCache) { Map<String, Object> subMap = UnsafeCastHelper.castToMap(fieldMap); Object subBean = ReflectionHelper.newInstance(getAssociatedType()); for (ParameterMapping parameter : parameters) { Object fieldValue = subMap.get(parameter.getSapName()); if (fieldValue != null) { Object value = parameter.mapToJava(fieldValue, converterCache); ReflectionHelper.setFieldValue(subBean, parameter.getJavaName(), value); } } return subBean; } }
StructureMapping extends ParameterMapping { @Override protected Object getUnconvertedValueToJava(final Object fieldMap, final ConverterCache converterCache) { Map<String, Object> subMap = UnsafeCastHelper.castToMap(fieldMap); Object subBean = ReflectionHelper.newInstance(getAssociatedType()); for (ParameterMapping parameter : parameters) { Object fieldValue = subMap.get(parameter.getSapName()); if (fieldValue != null) { Object value = parameter.mapToJava(fieldValue, converterCache); ReflectionHelper.setFieldValue(subBean, parameter.getJavaName(), value); } } return subBean; } StructureMapping(final Class<?> associatedClass,
                            final String sapName,
                            final String javaName,
                            final Class<? extends Converter<?, ?>> converterClass); }
StructureMapping extends ParameterMapping { @Override protected Object getUnconvertedValueToJava(final Object fieldMap, final ConverterCache converterCache) { Map<String, Object> subMap = UnsafeCastHelper.castToMap(fieldMap); Object subBean = ReflectionHelper.newInstance(getAssociatedType()); for (ParameterMapping parameter : parameters) { Object fieldValue = subMap.get(parameter.getSapName()); if (fieldValue != null) { Object value = parameter.mapToJava(fieldValue, converterCache); ReflectionHelper.setFieldValue(subBean, parameter.getJavaName(), value); } } return subBean; } StructureMapping(final Class<?> associatedClass,
                            final String sapName,
                            final String javaName,
                            final Class<? extends Converter<?, ?>> converterClass); void addParameter(final ParameterMapping param); Set<ParameterMapping> getParameters(); @Override ParamType getParamType(); @Override @Generated("") boolean equals(final Object o); @Override @Generated("") int hashCode(); }
StructureMapping extends ParameterMapping { @Override protected Object getUnconvertedValueToJava(final Object fieldMap, final ConverterCache converterCache) { Map<String, Object> subMap = UnsafeCastHelper.castToMap(fieldMap); Object subBean = ReflectionHelper.newInstance(getAssociatedType()); for (ParameterMapping parameter : parameters) { Object fieldValue = subMap.get(parameter.getSapName()); if (fieldValue != null) { Object value = parameter.mapToJava(fieldValue, converterCache); ReflectionHelper.setFieldValue(subBean, parameter.getJavaName(), value); } } return subBean; } StructureMapping(final Class<?> associatedClass,
                            final String sapName,
                            final String javaName,
                            final Class<? extends Converter<?, ?>> converterClass); void addParameter(final ParameterMapping param); Set<ParameterMapping> getParameters(); @Override ParamType getParamType(); @Override @Generated("") boolean equals(final Object o); @Override @Generated("") int hashCode();  }