Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

field-exclude : getter & setter required ?

Help
seb
2005-08-16
2013-05-02
  • seb
    seb
    2005-08-16

    Hi guys,

    Nice to find a new release this morning !
    Field-exclude tag seems to work perfectly, BUT i found that getter & setter for the field to exclude are still needed ...

    Last but not the least. I've changed XSD validation to DTD one, but i can't use the one-way attribute in the mapping type anyway.

    Thx
    Seb

     
    • >Field-exclude tag seems to work perfectly, BUT i found >that getter & setter for the field to exclude are still needed

      Do you mean the functionality to define what the getter() and setter() method names are...if the Java Bean doesn't follow the familiar Java Bean pattern?  This is planned for our next release...a week or so.

      >Last but not the least. I've changed XSD validation to DTD
      >one, but i can't use the one-way attribute in the mapping type anyway.

      I don't understand what this use case is. Can you please give me an example.

      Thanks.

      Franz

       
    • seb
      seb
      2005-08-16

      1/ It's in the case you simply don't have any getter or/and setter methods

      2/ Last week, my dozerBeanMapping.xml was like that :

      <?xml version="1.0" encoding="UTF-8"?>
      <mappings 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="http://dozer.sourceforge.net/xsd/dozerbeanmapping.xsd">
      (...)
      <mapping type="one-way">
      (...)

      And now, it's :

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE mappings PUBLIC "-//DOZER//DTD MAPPINGS//EN" "http://dozer.sourceforge.net/dtd/dozerbeanmapping.dtd">
      <mappings>
      (...)
      <mapping type="one-way">
      (...)

      And i've got an error message. The former XSD file was containing the following section :

      <!-- enumeration of possible mapping types -->
        <xs:simpleType name="mappingType">
          <xs:restriction base="xs:string">
            <xs:enumeration value="one-way"/>
         </xs:restriction>
        </xs:simpleType> 

      But i can't find the equivalent one in the DTD file ...

       
      • Well, we don't have any one-way unit tests so I missed that one. Sorry about that.

        <!ATTLIST mapping type (one-way | bi-directional) "bi-directional" >

        Should be in the DTD. I will put this in for tonight's release.

        I didn't think we mapped fields without getter() setter() attributes. Is this not the case? Without getter() and setter() there is no way for us to map anyways...so by default I would expect them to be excluded?

        Thanks.

        Franz

         
    • seb
      seb
      2005-08-16

      Well, it's true, i have some beans that don't follow the Java Bean pattern, so, some fields come without "standard" getter() and setter() methods. I just want to avoid them to be mapped, so was my proposition for the <field-exclude> tag. But for those 'unmapped' fields, Dozer still needs getter() and setter() methods ...

       
    • Ben Sullins
      Ben Sullins
      2005-08-16

      Fields that do not follow javabean spec will not be mapped (you don't have to exclude them).  If you add an exclude field, we still look for getters and setters.  However, if they are not java bean attributes, just don't put them in the mapping xml file.