org.klojang.templates.SessionConfig Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of klojang-templates Show documentation
Show all versions of klojang-templates Show documentation
Zero-Logic Templates for Java Programmers
The newest version!
package org.klojang.templates;
import static org.klojang.templates.AccessorRegistry.STANDARD_ACCESSORS;
import static org.klojang.templates.StringifierRegistry.STANDARD_STRINGIFIERS;
record SessionConfig(Template template,
AccessorRegistry accessors,
StringifierRegistry stringifiers) {
SessionConfig(Template template) {
this(template, STANDARD_ACCESSORS, STANDARD_STRINGIFIERS);
}
SessionConfig(Template template, StringifierRegistry stringifiers) {
this(template, STANDARD_ACCESSORS, stringifiers);
}
SessionConfig(Template template, AccessorRegistry accessors) {
this(template, accessors, STANDARD_STRINGIFIERS);
}
SoloSession newRenderSession() {
return new SoloSession(this);
}
Accessor> getAccessor(Object sourceData) {
return accessors.getAccessor(sourceData, template);
}
SoloSession newChildSession(Template nested) {
SessionConfig config = new SessionConfig(nested, accessors, stringifiers);
return config.newRenderSession();
}
}