Gwt 代理接口中的非setter/getter方法
有没有一种方法可以将非setter/getter方法放在我们定义的代理接口中 例如Gwt 代理接口中的非setter/getter方法,gwt,requestfactory,Gwt,Requestfactory,有没有一种方法可以将非setter/getter方法放在我们定义的代理接口中 例如 @ProxyFor( value = requestFactory.example.gwt.server.domain.Person.class ) public interface PersonProxy extends EntityProxy { String getLastName(); String getFirstName(); void setLastName( Strin
@ProxyFor( value = requestFactory.example.gwt.server.domain.Person.class )
public interface PersonProxy extends EntityProxy
{
String getLastName();
String getFirstName();
void setLastName( String nachname );
void setFirstName( String vorname );
public Long getId();
public Integer getVersion();
void setProperty(String name, Object value);
}
上面示例中的最后一个方法抛出一个异常“只允许setter和getter”。有办法解决这个问题吗?提前谢谢。
不可以。代理只能有getter和setter
但是,对于要进行的相同服务器端调用,您可以将方法添加到RequestContext
:
InstanceRequestSetProperty(字符串名称、字符串值);
用作:
context.setProperty(“foo”、“bar”)。使用(personProxy);
请注意,您也不能使用对象
(在您询问:否之前,您不能有重载,因此您必须在服务器端使用类似命名方法添加setPropertyString
、setPropertyState
、setPropertySouble
等)