public void setExtended_deprecated(String extended, InvokeTemplateParser.ParameterDeclarationList args, int lineNo) {
if (null != this.extended) {
throw new IllegalStateException("Extended template already declared");
}
TemplateClass tc = null;
String origin = extended;
if (!extended.startsWith("/")) {
// relative path ?
String me = templateClass.getKey().toString();
int pos = me.lastIndexOf("/");
if (-1 != pos) extended = me.substring(0, pos) + "/" + extended;
tc = engine.classes().getByTemplate(extended);
if (null == tc) {
ITemplateResource resource = engine.resourceManager().getResource(extended);
if (resource.isValid()) {
tc = new TemplateClass(resource, engine);
}
}
}
if (null == tc && !extended.startsWith("/")) {
// it's in class name style ?
//if (!extended.endsWith(TemplateClass.CN_SUFFIX)) extended = extended + TemplateClass.CN_SUFFIX;
tc = engine.classes().getByClassName(extended);
}
if (null == tc) {
tc = engine.classes().getByTemplate(origin);
if (null == tc) {
ITemplateResource resource = engine.resourceManager().getResource(origin);
if (resource.isValid()) tc = new TemplateClass(resource, engine);
}
}
if (null == tc) {
throw new ParseException(engine, templateClass, lineNo, "Cannot find extended template by name \"%s\"", origin);
}
this.extended = tc.name();
this.extendedTemplateClass = tc;
this.templateClass.extendedTemplateClass = tc;
this.engine.addExtendRelationship(tc, this.templateClass);
this.extendArgs = args;
this.extendDeclareLineNo = lineNo;