입니다.이 클래스는 magnolia에서 찾았습니다. 클래스 정의를 사용하는 CMS 소스 저는 아직 익숙하지 않습니다. 다음 코드 스타일의 사용에 대한 지식을 가진 사람이라면 정확히 이것이 무엇을하는지 설명 할 수 있습니까?다음 Java 코드 줄의 의미는
이 코드 샘플에서는 RenderingModel
과 RenderableDefinition
이 둘 다 인터페이스입니다. 내가 알고 있듯이 한 클래스에 두 개의 인터페이스를 구현할 수는 없지만 여기에서는 다른 방식으로 구현됩니다. 누군가가 나에게 특히 다음 줄에 사용되는 기술을 설명 할 수있다 :
public class RenderingModelImpl < RD extends RenderableDefinition >
implements RenderingModel {
다음 당신이 자바 제네릭입니다 magnolia java docs
public class RenderingModelImpl < RD
extends RenderableDefinition >
implements RenderingModel {
protected final RenderingModel parentModel;
protected final Content content;
protected final RD definition;
public RenderingModelImpl(Content content, RD definition, RenderingModel
parent) {
this.content = content;
this.definition = definition;
this.parentModel = parent;
}
public RenderingModel getParent() {
return this.parentModel;
}
public RenderingModel getRoot(){
RenderingModel model = this;
while(model.getParent() != null){
model = model.getParent();
}
return model;
}
public Content getContent() {
return this.content;
}
/**
* Shortname for templates: model.def.
*/
public RD getDef() {
return getDefinition();
}
public RD getDefinition() {
return this.definition;
}
public String execute() {
return null;
}
}