cdc.mf.html.adaptors.IndexSectionAdaptor Maven / Gradle / Ivy
package cdc.mf.html.adaptors;
import org.stringtemplate.v4.Interpreter;
import org.stringtemplate.v4.ST;
import org.stringtemplate.v4.misc.ObjectModelAdaptor;
import org.stringtemplate.v4.misc.STNoSuchPropertyException;
import cdc.mf.html.MfHtmlGenerationArgs;
import cdc.mf.html.MfParams;
import cdc.mf.html.index.IndexSection;
public class IndexSectionAdaptor extends ObjectModelAdaptor {
@SuppressWarnings("unused")
private final MfHtmlGenerationArgs args;
public IndexSectionAdaptor(MfHtmlGenerationArgs args) {
this.args = args;
}
@Override
public synchronized Object getProperty(Interpreter interp,
ST self,
IndexSection section,
Object property,
String propertyName) throws STNoSuchPropertyException {
switch (propertyName) {
case "kind":
return "section";
case "displayName":
return section.getKey();
case "upPath":
return ".."; // TODO
case "htmlId":
return MfParams.getHtmlId(section);
default:
break;
}
return super.getProperty(interp, self, section, property, propertyName);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy