2012-09-24 70 views
0

RequestContext方法中存在的方法是否可以返回void?从RequestContext方法返回Void

如果我的RequestContext看起来像这样,

@Service(value = PersonUtil.class, locator = PersonLocator.class) 
public interface PersonRequest extends RequestContext 
{ 

    Request<void> testMethod(Long id); 
    ...... 
} 

我收到此错误:

多个标记在该行 - 该方法的返回类型是缺少 - 令牌“无效语法错误“,预计的尺寸

我们不能创建一个返回类型为void的方法吗?如果没有,为什么会这样呢?

在此先感谢。

回答

1

void就像原始类型,如intboolean,您不能将其用作类型参数。

和你一样会使用Integer,而不是int,你会在这里使用Voidjava.lang.Void

+0

谢谢。我错过了那个基本的东西。 – LPD