我有使用标准bean约定的wsimport-ed Java类:
public class Request {
protected String vin;
public String getVin() {
return vin;
}
public void setVin(String value) {
this.vin = value;
}
}
我希望在Kotlin中使用这个类,使用不错的属性语法:
override fun search(request: Request): Response {
log.info("search(vin={})", request.vin);
...
但是这段代码没有编译:
Error:(59, 64) Kotlin: Cannot access 'vin': it is 'protected/*protected and package*/' in 'SmvSearchRequest'
request.getVin()
当然有效,但看起来并不比Java好。有没有办法将这些类作为财产持有人对待?