All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gwtplatform.dispatch.annotation.GenDto Maven / Gradle / Ivy

There is a newer version: 1.6
Show newest version
/**
 * Copyright 2010 ArcBees Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package com.gwtplatform.dispatch.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Annotation to generate simple Data Transfer Object (DTO) classes solely for
 * transferring data between the client and the server.
 * 

* If you type: * *

 *  
 * {@literal}@GenDto
 * public class LineItem {
 *   Key<Product> productKey;
 *   int quantity; 
 * }
 * 
 * 
* * gwt-platform will generate a {@code LineItemDto} class. *

* {@code LineItemDto} will have fields, getters, and a constructor that takes * {@code productKey} and quantity plus equals, hashCode, toString etc, *

* {@code LineItemDto} could be used when creating an invoice. * *

 *  
 * {@literal}@GenDispatch
 * public class CreateInvoice {
 *   {@literal}@In Key<Customer> customerKey
 *   {@literal}@In LineItemDto[] lineItems
 *   {@literal}@Out Invoice invoice;
 * }
 * 
 * 
* * The alternative to using Dto classes would be to construct persistable * {@code LineItem} objects on the client and send them as part of the gwt-rpc call. * Using Dto classes is a better choice because: *
    *
  • Lower bandwidth.
  • *
  • The client cannot be trusted. The {@code LineItem} persistable object will * probably have a price field. The server should ignore the price as it may * have been tampered with.
  • *
* *

* Notes: *

* There is no naming requirement for your class name. It will be appended with * Dto * *

* * @author Brendan Doherty * @author Florian Sauter * @author Stephen Haberman (concept) */ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Inherited public @interface GenDto { }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy