Package org.dozer.fieldmap

Examples of org.dozer.fieldmap.FieldMap


        }
    }

    @Override
    public void preWritingDestinationValue(DozerEvent event) {
        FieldMap fm = event.getFieldMap();
        Object o = event.getDestinationValue();
        if (o instanceof List<?>) {
            List<?> l = (List<?>) o;
            if (l.size() > 0) {
                // Correction : prise en compte du cas o� la liste contient des nulls.
                Class<?> c = null;
                HintContainer hc = new HintContainer();
                for (Object element : l) {
                    if (element != null) {
                        c = element.getClass();
                        break;
                    }
                }
                if (c == null) {
                    c = Void.class;
                }
                hc.setHintName(c.getName());
                fm.setDestHintContainer(hc);
            }
        }

    }
View Full Code Here


        }
    }

    @Override
    public void preWritingDestinationValue(DozerEvent event) {
        FieldMap fm = event.getFieldMap();
        Object o = event.getDestinationValue();
        if (o instanceof List<?>) {
            List<?> l = (List<?>) o;
            if (l.size() > 0) {
                // Correction : prise en compte du cas o� la liste contient des nulls.
                Class<?> c = null;
                HintContainer hc = new HintContainer();
                for (Object element : l) {
                    if (element != null) {
                        c = element.getClass();
                        break;
                    }
                }
                if (c == null) {
                    c = Void.class;
                }
                hc.setHintName(c.getName());
                fm.setDestHintContainer(hc);
            }
        }

    }
View Full Code Here

        }
    }

    @Override
    public void preWritingDestinationValue(DozerEvent event) {
        FieldMap fm = event.getFieldMap();
        Object o = event.getDestinationValue();
        if (o instanceof List<?>) {
            List<?> l = (List<?>) o;
            if (l.size() > 0) {
                // Correction : prise en compte du cas o� la liste contient des nulls.
                Class<?> c = null;
                HintContainer hc = new HintContainer();
                for (Object element : l) {
                    if (element != null) {
                        c = element.getClass();
                        break;
                    }
                }
                if (c == null) {
                    c = Void.class;
                }
                hc.setHintName(c.getName());
                fm.setDestHintContainer(hc);
            }
        }

    }
View Full Code Here

        }
    }

    @Override
    public void preWritingDestinationValue(DozerEvent event) {
        FieldMap fm = event.getFieldMap();
        Object o = event.getDestinationValue();
        if (o instanceof List<?>) {
            List<?> l = (List<?>) o;
            if (l.size() > 0) {
                // Correction : prise en compte du cas o� la liste contient des nulls.
                Class<?> c = null;
                HintContainer hc = new HintContainer();
                for (Object element : l) {
                    if (element != null) {
                        c = element.getClass();
                        break;
                    }
                }
                if (c == null) {
                    c = Void.class;
                }
                hc.setHintName(c.getName());
                fm.setDestHintContainer(hc);
            }
        }

    }
View Full Code Here

        }
    }

    @Override
    public void preWritingDestinationValue(DozerEvent event) {
        FieldMap fm = event.getFieldMap();
        Object o = event.getDestinationValue();
        if (o instanceof List<?>) {
            List<?> l = (List<?>) o;
            if (l.size() > 0) {
                // Correction : prise en compte du cas o� la liste contient des nulls.
                Class<?> c = null;
                HintContainer hc = new HintContainer();
                for (Object element : l) {
                    if (element != null) {
                        c = element.getClass();
                        break;
                    }
                }
                if (c == null) {
                    c = Void.class;
                }
                hc.setHintName(c.getName());
                fm.setDestHintContainer(hc);
            }
        }

    }
View Full Code Here

        }
    }

    @Override
    public void preWritingDestinationValue(DozerEvent event) {
        FieldMap fm = event.getFieldMap();
        Object o = event.getDestinationValue();
        if (o instanceof List<?>) {
            List<?> l = (List<?>) o;
            if (l.size() > 0) {
                // Correction : prise en compte du cas o� la liste contient des nulls.
                Class<?> c = null;
                HintContainer hc = new HintContainer();
                for (Object element : l) {
                    if (element != null) {
                        c = element.getClass();
                        break;
                    }
                }
                if (c == null) {
                    c = Void.class;
                }
                hc.setHintName(c.getName());
                fm.setDestHintContainer(hc);
            }
        }

    }
View Full Code Here

        }
    }

    @Override
    public void preWritingDestinationValue(DozerEvent event) {
        FieldMap fm = event.getFieldMap();
        Object o = event.getDestinationValue();
        if (o instanceof List<?>) {
            List<?> l = (List<?>) o;
            if (l.size() > 0) {
                // Correction : prise en compte du cas o� la liste contient des nulls.
                Class<?> c = null;
                HintContainer hc = new HintContainer();
                for (Object element : l) {
                    if (element != null) {
                        c = element.getClass();
                        break;
                    }
                }
                if (c == null) {
                    c = Void.class;
                }
                hc.setHintName(c.getName());
                fm.setDestHintContainer(hc);
            }
        }

    }
View Full Code Here

      // If source property does not have a read method, then skip
      if (srcProperty == null || srcProperty.getReadMethod() == null) {
        continue;
      }

      FieldMap map;
      DozerField field = new DozerField(destFieldName, null);
      if (field.isCustomGetterSetterField()) {
        map = new CustomGetSetMethodFieldMap(classMap);
      } else {
        map = new GenericFieldMap(classMap);
      }
      map.setSrcField(new DozerField(destFieldName, null));
      map.setDestField(new DozerField(destFieldName, null));
      // add CopyByReferences per defect #1728159
      MappingUtils.applyGlobalCopyByReference(globalConfiguration, map, classMap);
      classMap.addFieldMapping(map);
    }
  }
View Full Code Here

      classMap.addFieldMapping(map);
    }
  }

  private static void addListDefaultMappings(ClassMap classMap) {
    FieldMap fieldMap = new GenericFieldMap(classMap);
    DozerField selfReference = new DozerField(DozerConstants.SELF_KEYWORD, null);
    fieldMap.setSrcField(selfReference);
    fieldMap.setDestField(selfReference);
    classMap.addFieldMapping(fieldMap);
  }
View Full Code Here

      if (!destinationIsMap && classMap.getFieldMapUsingDest(fieldName, true) != null) {
        continue;
      }

      FieldMap map = new MapFieldMap(classMap);
      DozerField srcField = new DozerField(MappingUtils.isSupportedMap(srcClass) ? DozerConstants.SELF_KEYWORD : fieldName, null);
      srcField.setKey(fieldName);

      if (StringUtils.isNotEmpty(classMap.getSrcClassMapGetMethod()) || StringUtils.isNotEmpty(classMap.getSrcClassMapSetMethod())) {
        srcField.setMapGetMethod(classMap.getSrcClassMapGetMethod());
        srcField.setMapSetMethod(classMap.getSrcClassMapSetMethod());
        srcField.setName(DozerConstants.SELF_KEYWORD);
      }

      DozerField destField = new DozerField(MappingUtils.isSupportedMap(destClass) ? DozerConstants.SELF_KEYWORD : fieldName, null);
      srcField.setKey(fieldName);

      if (StringUtils.isNotEmpty(classMap.getDestClassMapGetMethod())
          || StringUtils.isNotEmpty(classMap.getDestClassMapSetMethod())) {
        destField.setMapGetMethod(classMap.getDestClassMapGetMethod());
        destField.setMapSetMethod(classMap.getDestClassMapSetMethod());
        destField.setName(DozerConstants.SELF_KEYWORD);
      }

      map.setSrcField(srcField);
      map.setDestField(destField);

      classMap.addFieldMapping(map);
    }
  }
View Full Code Here

TOP

Related Classes of org.dozer.fieldmap.FieldMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.