Examples of DozerField


Examples of org.dozer.fieldmap.DozerField

      fieldName = name;
    }
    if (StringUtils.isNotEmpty(type)) {
      fieldType = type;
    }
    DozerField field = new DozerField(fieldName, fieldType);
    if (isIndexed(name)) {
      field.setIndexed(true);
      field.setIndex(getIndexOfIndexedField(name));
    }
    return field;
  }
View Full Code Here

Examples of org.dozer.fieldmap.DozerField

  private static void addFieldMapping(ClassMap classMap, Configuration configuration,
                                      String srcName, String destName) {
    FieldMap fieldMap = new GenericFieldMap(classMap);

    DozerField sourceField = new DozerField(srcName, null);
    DozerField destField = new DozerField(destName, null);

    sourceField.setAccessible(true);
    destField.setAccessible(true);

    fieldMap.setSrcField(sourceField);
    fieldMap.setDestField(destField);

    // add CopyByReferences per defect #1728159
View Full Code Here

Examples of org.dozer.fieldmap.DozerField

  private static void addGenericMapping(ClassMap classMap, Configuration configuration,
                                        String srcName, String destName) {
    FieldMap fieldMap = new GenericFieldMap(classMap);

    fieldMap.setSrcField(new DozerField(srcName, null));
    fieldMap.setDestField(new DozerField(destName, null));

    // add CopyByReferences per defect #1728159
    MappingUtils.applyGlobalCopyByReference(configuration, fieldMap, classMap);
    classMap.addFieldMapping(fieldMap);
  }
View Full Code Here

Examples of org.dozer.fieldmap.DozerField

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

        FieldMap fieldMap = 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);
        }

        fieldMap.setSrcField(srcField);
        fieldMap.setDestField(destField);
View Full Code Here

Examples of org.dozer.fieldmap.DozerField

    public void type(MappingDirection type) {
      fieldMap.setType(type);
    }

    public FieldDefinitionBuilder a(String name, String type) {
      DozerField field = prepareField(name, type);
      fieldMap.setSrcField(field);
      return new FieldDefinitionBuilder(field);
    }
View Full Code Here

Examples of org.dozer.fieldmap.DozerField

      fieldMap.setSrcField(field);
      return new FieldDefinitionBuilder(field);
    }

    public FieldDefinitionBuilder b(String name, String type) {
      DozerField field = prepareField(name, type);
      fieldMap.setDestField(field);
      return new FieldDefinitionBuilder(field);
    }
View Full Code Here

Examples of org.dozer.fieldmap.DozerField

      return MappingUtils.isSupportedCollection(srcClass) && MappingUtils.isSupportedCollection(destClass);
    }

    public boolean apply(ClassMap classMap, Configuration configuration) {
      FieldMap fieldMap = new GenericFieldMap(classMap);
      DozerField selfReference = new DozerField(DozerConstants.SELF_KEYWORD, null);
      fieldMap.setSrcField(selfReference);
      fieldMap.setDestField(selfReference);
      classMap.addFieldMapping(fieldMap);
      return true;
    }
View Full Code Here

Examples of org.dozer.fieldmap.DozerField

    public FieldDefinitionBuilder a(String name) {
      return a(name, null);
    }

    public FieldDefinitionBuilder a(String name, String type) {
      DozerField field = DozerBuilder.prepareField(name, type);
      this.srcField = field;
      return new FieldDefinitionBuilder(field);
    }
View Full Code Here

Examples of org.dozer.fieldmap.DozerField

    public FieldDefinitionBuilder b(String name) {
      return b(name, null);
    }

    public FieldDefinitionBuilder b(String name, String type) {
      DozerField field = prepareField(name, type);
      this.destField = field;
      return new FieldDefinitionBuilder(field);
    }
View Full Code Here

Examples of org.dozer.fieldmap.DozerField

*/
public class GetterSetterPropertyDescriptorTest extends AbstractDozerTest {

  @Test
  public void testGetReadMethod() throws Exception {
    DozerField dozerField = new DozerField("destField", "generic");

    JavaBeanPropertyDescriptor pd = new JavaBeanPropertyDescriptor(Dest.class, dozerField.getName(), dozerField.isIndexed(),
        dozerField.getIndex(), null, null);
    Method method = pd.getReadMethod();

    assertNotNull("method should not be null", method);
    assertEquals("incorrect method found", "getDestField", method.getName());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.