#12 custom convertor not associated with hints

closed
None
5
2005-10-31
2005-10-10
Anonymous
No

// this configuration won't be attached to the
collection "names" hints

<configuration>
<customConverters>
<converter type="NameConvertor" >
<classA>org.test.Name</classA>
<classB>java.lang.String</classB>
</converter>
</customConverters>
</configuration>

<mapping>
<classA>org.test.Outer</classA>
<classB>org.test.OuterTO</classB>
<field>
<A>names</A>
<B>names</B>
<sourceTypeHint>org.test.Name</sourceTypeHint>

<destinationTypeHint>java.lang.String</destinationTypeHint>
</field>
</mapping>

Discussion

  • Ben Sullins

    Ben Sullins - 2005-10-10
    • assigned_to: nobody --> bgsesr
     
  • Ben Sullins

    Ben Sullins - 2005-10-10

    Logged In: YES
    user_id=1232046

    thats a good one.

     
  • Franz Garsombke

    Franz Garsombke - 2005-10-13
    • assigned_to: bgsesr --> fgarsombke
     
  • Franz Garsombke

    Franz Garsombke - 2005-10-13

    Logged In: YES
    user_id=550744

    I will fix this for the 1.5.5 release

     
  • Franz Garsombke

    Franz Garsombke - 2005-10-13

    Logged In: YES
    user_id=550744

    I wrote a unit test and this seems to work. Every class map
    gets all of the custom converters defined in the mapping
    file. So when we reach the mapOrRecurseObject() method all
    of these conditions hold true:

    if (classMap.getConfiguration().getCustomConverters() !=
    null
    &&
    classMap.getConfiguration().getCustomConverters().getConverterByDestinationType(destFieldType.getName(),
    sourceFieldClass.getName()) != null) {

    What behavior are you seeing?

    --------------------------------

    private Object mapOrRecurseObject(Object sourceFieldValue,
    Class destFieldType, ClassMap classMap, FieldMap fieldMap,
    Object destObj) {
    if (sourceFieldValue == null) {
    return null;
    }

    Object rvalue = null;
    Class sourceFieldClass = sourceFieldValue.getClass();

    if (classMap.getConfiguration().getCustomConverters() !=
    null
    &&
    classMap.getConfiguration().getCustomConverters().getConverterByDestinationType(destFieldType.getName(),
    sourceFieldClass.getName()) != null) {
    rvalue = mapUsingCustomConverter(sourceFieldClass,
    sourceFieldValue, destFieldType, classMap, destObj, fieldMap,

     
  • Rohan Hart

    Rohan Hart - 2005-10-21

    Logged In: YES
    user_id=774102

    I'll mail you a unit test as it seems that files can't be
    added to open bugs.

    The problem looks like it's triggered by iterated lists

     
  • Franz Garsombke

    Franz Garsombke - 2005-10-21
    • status: open --> pending
     
  • Franz Garsombke

    Franz Garsombke - 2005-10-21

    Logged In: YES
    user_id=550744

    Thanks for all of that information. This has been fixed for
    1.5.6. I have attached the patched MappingProccessor.java. I
    have also incorporated your tests into our test suite.

    Thanks.

    Franz

     
  • Franz Garsombke

    Franz Garsombke - 2005-10-31
    • 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