我对 Java 还很陌生,所以请耐心等待。我一生都无法弄清楚为什么我在 resourceResolver.resolve 上遇到找不到符号错误。当在它上面的行上时,我正在定义变量。也许这是我想念的简单的东西,但我无法弄清楚,我觉得我已经盯着这种方式看了很久。
private static final String ROOTCHILD = "rootChild";
public void setResource(Resource resource) {
this.resource = resource;
}
public void setProperties(ValueMap properties) {
this.properties = properties;
}
public Page getRootPage() {
ResourceResolver resourceResolver = getResource().getResourceResolver();
return (this.properties != null)
? resourceResolver.resolve(
properties.get( ROOTCHILD,currentPage.getPath())).adaptTo(Page.class)
: null;
}