ArcBees/GWTP — pull request #17 by fsauter (2012-11-04 10:56:44+00:00)
Title: Implemented @GenProxy

Implementation of #15. Please rate, comment, subscribe..

# Examples

## Example 1
### EntityProxy using embedded proxies

```java
@GenProxy
public class Person {

int id;

Long age;

float weight;

@UseProxyName("com.gwtplatform.dispatch.annotation.proxy.AddressProxy")
Address addressDetail;

@UseProxy(DetailProxy.class)
Detail detail;

}
```

```java
@ProxyFor(com.gwtplatform.dispatch.annotation.Person.class)
public interface PersonProxy extends EntityProxy {

EntityProxyId stableId();

int getId();

java.lang.Long getAge();

float getWeight();

com.gwtplatform.dispatch.annotation.proxy.AddressProxy getAddressDetail();

com.gwtplatform.dispatch.annotation.DetailProxy getDetail();

void setId(int id);

void setAge(java.lang.Long age);

void setWeight(float weight);

void setAddressDetail(com.gwtplatform.dispatch.annotation.proxy.AddressProxy addressDetail);

void setDetail(com.gwtplatform.dispatch.annotation.DetailProxy detail);

}
```

## Example 2
### ValueProxy using custom target package

```java
@GenProxy(
targetPackage = "com.gwtplatform.dispatch.annotation.proxy",
isEmbeddedType = true
)
public class Address {

public String street;

}
```

```java
package com.gwtplatform.dispatch.annotation.proxy;

// Imports...

@ProxyFor(com.gwtplatform.dispatch.annotation.Address.class)
public interface AddressProxy extends ValueProxy {

java.lang.String getStreet();

void setStreet(java.lang.String street);

}
```

## Example 3
### EntityProxy using custom locator and getter/setter filter

```java
@GenProxy(
targetPackage = "com.gwtplatform.dispatch.annotation.proxy",
filterSetter = { "id" },
filterGetter = { "version" },
locator = EmployeeLocator.class
)
public class Employee {

private String displayName;
private Long supervisorKey;
private Long id;
private Integer version;

@UseProxyName("com.gwtplatform.dispatch.annotation.proxy.EmployeeProxy")
private Employee supervisor;

// Getter and setters...
}
```
```java
package com.gwtplatform.dispatch.annotation.proxy;

// Imports...

@ProxyFor(value = com.gwtplatform.dispatch.annotation.Employee.class, locator = com.gwtplatform.dispatch.annotation.EmployeeLocator.class)
public interface EmployeeProxy extends EntityProxy {

EntityProxyId stableId();

java.lang.String getDisplayName();

java.lang.Long getSupervisorKey();

java.lang.Long getId();

com.gwtplatform.dispatch.annotation.proxy.EmployeeProxy getSupervisor();

void setDisplayName(java.lang.String displayName);

void setSupervisorKey(java.lang.Long supervisorKey);

void setVersion(java.lang.Integer version);

void setSupervisor(com.gwtplatform.dispatch.annotation.proxy.EmployeeProxy supervisor);

}
```

Please tell me any improvements or if I missed something.