#83 When discovering default field mappings require corr get/set

closed
None
5
2007-04-27
2007-04-20
No

When adding default field mappings via reflectionUtils.getPropertyDescriptors() make sure that a getReadMethodName and getWriteMethodName exists in the PropertyDescriptor before adding the field to be mapped.

Currently all property descriptors that are discovered are added. The underlying implementation Introspector.getBeanInfo(class) returns a property descriptor even if there isn't an actual field and doesnt check that there is both a getter and setter. In the following example, Instrospector.getBeanInfo would return a property descriptor for field1. This is a problem problem for bi-directional mappings via Dozer.

public class SomeObject {
public String getField1() {
return "";
}
}

Discussion

  • Matt Tierney

    Matt Tierney - 2007-04-21

    Logged In: YES
    user_id=1236069
    Originator: YES

    NOTE: This logic should only apply in the case that the src class is the same type as the dest class. SomeObj --> SomeObj

     
  • Matt Tierney

    Matt Tierney - 2007-04-21
    • status: open --> pending
     
  • Matt Tierney

    Matt Tierney - 2007-04-21

    Logged In: YES
    user_id=1236069
    Originator: YES

    Attaching patch
    File Added: dozer-3.2.1_1704085.jar

     
  • Matt Tierney

    Matt Tierney - 2007-04-23
    • status: pending --> open
     
  • Matt Tierney

    Matt Tierney - 2007-04-23

    Logged In: YES
    user_id=1236069
    Originator: YES

    After further investigation, I think the logic should apply to all class mapping and not just mapping where the src class is the same as the dest class.

     
  • Matt Tierney

    Matt Tierney - 2007-04-24

    Logged In: YES
    user_id=1236069
    Originator: YES

    Applied to all cases. Not just when src class is the same type as the dest class

     
  • Matt Tierney

    Matt Tierney - 2007-04-24
    • assigned_to: nobody --> mhtierney
    • status: open --> pending
     
  • Matt Tierney

    Matt Tierney - 2007-04-25
    • summary: When discovering default field mappings require both get/set --> When discovering default field mappings require corr get/set
    • status: pending --> open
     
  • Matt Tierney

    Matt Tierney - 2007-04-25
    • status: open --> pending
     
  • Matt Tierney

    Matt Tierney - 2007-04-25
    • status: pending --> open
     
  • Matt Tierney

    Matt Tierney - 2007-04-25

    Logged In: YES
    user_id=1236069
    Originator: YES

    Adding patch jar that includes use cases where src class type does not match dest class type
    File Added: dozer-3.2.1_1704085.jar

     
  • Matt Tierney

    Matt Tierney - 2007-04-25
    • status: open --> pending
     
  • Matt Tierney

    Matt Tierney - 2007-04-27
    • status: pending --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks