Message:

   The following issue has been re-assigned.

   Assignee: Matthias Germann (mailto:[EMAIL PROTECTED])
---------------------------------------------------------------------
View the issue:
  http://opensource.atlassian.com/projects/xdoclet/browse/XDT-1386

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XDT-1386
    Summary: valueobject.xdt inappropriately deprecates copy constructor
       Type: Bug

     Status: Open
   Priority: Major

 Original Estimate: Unknown
 Time Spent: Unknown
  Remaining: Unknown

    Project: XDoclet
 Components: 
             EJB Module
   Fix Fors:
             1.3
   Versions:
             1.2.3

   Assignee: Matthias Germann
   Reporter: Ari Miller

    Created: Fri, 6 May 2005 4:41 PM
    Updated: Mon, 9 May 2005 4:10 PM
Environment: Windows XP.  java version "1.5.0_01"

Description:
The copy constructor for value objects has been deprecated, with a comment to 
use clone instead.  Clone works great if all you are trying to do with the 
constructor is create an exact copy of the object.  The problem with 
deprecating this constructor is that it is very useful when extending the 
generated value object.  I think the deprecation should be removed from the 
copy constructor in the valueobject.xdt template.
I've done so in an attached version of valueobject.xdt, attached to 
http://opensource.atlassian.com/projects/xdoclet/browse/XDT-1385.

To explain further:
Say that I code generate a PurchaseOrderDTO object with XDoclet.  But I want to 
automatically lookup the full name of the purchasing user and include it in the 
DTO I actually send back.  
All I need to do currently is extend PurchaseOrderDTO in a new object, call it 
PurchaseOrderDTOEnhanced, and add a constructor which takes a basic 
PurchaseOrderDTO, calls super to access the copy constructor on 
PurchaseOrderDTO, and then looks up the name of the purchasing user based on 
the id.  
The code looks something likes this
PurchaseOrderExtendedDTO extends PurchaseOrderDTO {
        public PurchaseOrderExtendedDTO(PurchaseOrderDTO base) {
                super(base);
                purchasingUserName = lookupUserName(this.getPurchasingUserId());
        }
}

By deprecating the copy constructor of PurchaseOrderDTO, I can no longer do 
this without calling a deprecated method.
At that point, I then either have to delegate to the underlying 
PurchaseOrderDTO, writing the appropriate delegation methods by hand, or write 
code to individually set the attributes of my extending class based on the 
value object passed in to the constructor.


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/xdoclet/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
xdoclet-devel mailing list
xdoclet-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to