Package org.dozer

Examples of org.dozer.Mapping


      Class<?> srcType = classMap.getSrcClassToMap();
      PropertyDescriptor[] srcProperties = ReflectionUtils.getPropertyDescriptors(srcType);
      for (PropertyDescriptor property : srcProperties) {
        Method readMethod = property.getReadMethod();
        if (readMethod != null) {
          Mapping mapping = readMethod.getAnnotation(Mapping.class);
          String propertyName = property.getName();
          if (mapping != null) {
            validate(mapping, readMethod);
            String pairName = mapping.value();
            addGenericMapping(classMap, configuration, propertyName, pairName);
          }
        }
      }

      Class<?> destType = classMap.getDestClassToMap();
      PropertyDescriptor[] destProperties = ReflectionUtils.getPropertyDescriptors(destType);
      for (PropertyDescriptor property : destProperties) {
        Method readMethod = property.getReadMethod();
        if (readMethod != null) {
          Mapping mapping = readMethod.getAnnotation(Mapping.class);
          String propertyName = property.getName();
          if (mapping != null) {
            validate(mapping, readMethod);
            String pairName = mapping.value();
            addGenericMapping(classMap, configuration, pairName, propertyName);
          }
        }
      }
View Full Code Here


    public boolean apply(ClassMap classMap, Configuration configuration) {
      Class<?> srcType = classMap.getSrcClassToMap();
      Field[] srcFields = srcType.getDeclaredFields();
      for (Field field : srcFields) {
        Mapping mapping = field.getAnnotation(Mapping.class);
        String fieldName = field.getName();
        if (mapping != null) {
          validate(mapping, field);
          String pairName = mapping.value();
          addFieldMapping(classMap, configuration, fieldName, pairName);
        }
      }

      Class<?> destType = classMap.getDestClassToMap();
      Field[] destFields = destType.getDeclaredFields();
      for (Field field : destFields) {
        Mapping mapping = field.getAnnotation(Mapping.class);
        String fieldName = field.getName();
        if (mapping != null) {
          validate(mapping, field);
          String pairName = mapping.value();
          addFieldMapping(classMap, configuration, pairName, fieldName);
        }
      }

      return false;
View Full Code Here

      Class<?> srcType = classMap.getSrcClassToMap();
      PropertyDescriptor[] srcProperties = ReflectionUtils.getPropertyDescriptors(srcType);
      for (PropertyDescriptor property : srcProperties) {
        Method readMethod = property.getReadMethod();
        if (readMethod != null) {
          Mapping mapping = readMethod.getAnnotation(Mapping.class);
          String propertyName = property.getName();
          if (mapping != null) {
            String pairName = mapping.value().trim();
            GeneratorUtils.addGenericMapping(classMap, configuration, propertyName, pairName.isEmpty() ? propertyName : pairName);
          }
        }
      }

      Class<?> destType = classMap.getDestClassToMap();
      PropertyDescriptor[] destProperties = ReflectionUtils.getPropertyDescriptors(destType);
      for (PropertyDescriptor property : destProperties) {
        Method readMethod = property.getReadMethod();
        if (readMethod != null) {
          Mapping mapping = readMethod.getAnnotation(Mapping.class);
          String propertyName = property.getName();
          if (mapping != null) {
            String pairName = mapping.value().trim();
            GeneratorUtils.addGenericMapping(classMap, configuration, pairName.isEmpty() ? propertyName : pairName, propertyName);
          }
        }
      }
View Full Code Here

    public boolean apply(ClassMap classMap, Configuration configuration) {
      Class<?> srcType = classMap.getSrcClassToMap();
      do {
        for (Field field : srcType.getDeclaredFields()) {
          Mapping mapping = field.getAnnotation(Mapping.class);
          String fieldName = field.getName();
          if (mapping != null) {
            String pairName = mapping.value().trim();
            addFieldMapping(classMap, configuration, fieldName, pairName.isEmpty() ? fieldName : pairName);
          }
        }
        srcType = srcType.getSuperclass();
      } while (srcType != null);
     
      Class<?> destType = classMap.getDestClassToMap();
      do {
        for (Field field : destType.getDeclaredFields()) {
          Mapping mapping = field.getAnnotation(Mapping.class);
          String fieldName = field.getName();
          if (mapping != null) {
            String pairName = mapping.value().trim();
            addFieldMapping(classMap, configuration, pairName.isEmpty() ? fieldName : pairName, fieldName);
          }
        }
        destType = destType.getSuperclass();
      } while (destType != null);
View Full Code Here

TOP

Related Classes of org.dozer.Mapping

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.