com.gwtplatform.dispatch.annotation.GenProxy Maven / Gradle / Ivy
/**
* Copyright 2011 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;
import com.google.web.bindery.requestfactory.shared.Locator;
/**
* Annotation to generate
* {@link com.google.web.bindery.requestfactory.shared.EntityProxy EntityProxy}
* and {@link com.google.web.bindery.requestfactory.shared.ValueProxy
* ValueProxy} classes.
*
* Simply annotate your entity with {@code GenProxy} and gwt-platform will
* generate you a {@link com.google.web.bindery.requestfactory.shared.ProxyFor
* ProxyFor} interface. The generated interface equals the given examples on DevGuideRequestFactory.
*
*
*
* Generate
*
*
*
* Fields as proxy:
*
You can declare fields as proxy using {@link UseProxy}
* or {@link @UseProxyName}.
*
* If you type:
*
*
* {@literal @}GenProxy
* public class Person {
* {@literal @}UseProxyName("com.gwtplatform.dispatch.annotation.AddressProxy")
* Address address;
* {@literal @}UseProxy(DetailProxy.class)
* Detail detail;
* }
*
*
* gwt-platform will generate the following EntityProxy.
*
*
* {@literal @}ProxyFor(com.gwtplatform.dispatch.annotation.Person.class)
* public interface PersonProxy extends EntityProxy {
* EntityProxyId{@literal <}PersonProxy{@literal >} stableId();
*
* com.gwtplatform.dispatch.annotation.AddressProxy getAddress();
* com.gwtplatform.dispatch.annotation.DetailProxy getDetail();
*
* void setAddress(com.gwtplatform.dispatch.annotation.AddressProxy address);
* void setDetail(com.gwtplatform.dispatch.annotation.DetailProxy detail);
* }
*
*
*
* Using Value Proxies: Set {@link #isEmbeddedType()} to true.
*
*
*
* Note: If your package name contains ".server", the processor
* automatically replaces this with ".shared". To avoid this behaviour, set the
* target package manual using {@link GenProxy#targetPackage()}.
*
*
* @author Florian Sauter
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.SOURCE)
@Inherited
public @interface GenProxy {
/**
* Defines the output package.
*
*
* By default the output is generated to the same source folder.
*
*
*
* If you are not using a custom target package, the processor will
* automatically replace ".server" in your package name with ".shared".
*
*
*
*
* {@code @GenProxy}(targetPackage = "com.example.package.server")
*
*
*/
String targetPackage() default "";
/**
* Add a property name to avoid the generation of a getter for this property.
*
*
* {@code @GenProxy}(filterGetter = {"id", "customer"})
*
*
* The properties "id" and "customer" will have no getters.
*/
String[] filterGetter() default {};
/**
* Add a property name to avoid the generation of a setter for this property.
*
*
* {@code @GenProxy}(filterSetter = {"id", "customer"})
*
*
* The properties "id" and "customer" will have no setters.
*/
String[] filterSetter() default {};
/**
* An embedded type results in a ValueProxy instead of an EntityProxy. By
* default, an EntityProxy is generated.
*/
boolean isEmbeddedType() default false;
/**
* @see ProxyFor#locator()
*/
@SuppressWarnings("rawtypes") Class extends Locator> locator() default com.google.web.bindery.requestfactory.shared.Locator.class;
}