@Target(value=TYPE) @Retention(value=RUNTIME) @Inherited public @interface GenDto
@GenDto
public class LineItem {
Key<Product> productKey;
int quantity;
}
gwt-platform will generate a LineItemDto
class.
LineItemDto
will have fields, getters, and a constructor that takes
productKey
and quantity plus equals, hashCode, toString etc,
LineItemDto
could be used when creating an invoice.
@GenDispatch
public class CreateInvoice {
@In Key<Customer> customerKey
@In LineItemDto[] lineItems
@Out Invoice invoice;
}
The alternative to using Dto classes would be to construct persistable
LineItem
objects on the client and send them as part of the gwt-rpc call.
Using Dto classes is a better choice because:
LineItem
persistable object will
probably have a price field. The server should ignore the price as it may
have been tampered with.Copyright © 2010–2014 Arcbees. All rights reserved.