Package org.jdbi.v3.stringtemplate4
Class StringTemplateSqlLocator
java.lang.Object
org.jdbi.v3.stringtemplate4.StringTemplateSqlLocator
Locates SQL in
.sql.stg StringTemplate group files on the classpath.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Map<ClassLoader,Map<String, ThreadLocal<org.stringtemplate.v4.STGroup>>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.stringtemplate.v4.STfindStringTemplate(Class<?> type, String name) Locates SQL for the given type and name.static org.stringtemplate.v4.STfindStringTemplate(ClassLoader classLoader, String path, String name) Locates SQL for the given type and name.static org.stringtemplate.v4.STfindStringTemplate(String path, String name) Locates SQL for the given type and name.static org.stringtemplate.v4.STGroupfindStringTemplateGroup(Class<?> type) Loads the StringTemplateGroup for the given type.static org.stringtemplate.v4.STGroupfindStringTemplateGroup(ClassLoader classLoader, String path) Loads the StringTemplateGroup from the given path on the classpath.static org.stringtemplate.v4.STGroupLoads the StringTemplateGroup from the given path on the classpath.private static org.stringtemplate.v4.STfindTemplateInGroup(String path, String name, org.stringtemplate.v4.STGroup group) private static org.stringtemplate.v4.STGroupreadStringTemplateGroup(ClassLoader classLoader, String path)
-
Field Details
-
CACHE
-
-
Constructor Details
-
StringTemplateSqlLocator
private StringTemplateSqlLocator()
-
-
Method Details
-
findStringTemplate
Locates SQL for the given type and name. Example: Given a typecom.foo.Barand a name ofbaz, loads a StringTemplate group file from the resource namedcom/foo/Bar.sql.stgon the classpath, and returns the template with the given name from the group.- Parameters:
type- the type that "owns" the given StringTemplate group file. Dictates the filename of the StringTemplate group file on the classpath.name- the template name within the StringTemplate group.- Returns:
- the located SQL.
-
findStringTemplate
Locates SQL for the given type and name. Loads a StringTemplate group from the resource at the given path, and returns the template with the given name from the group.- Parameters:
path- the resource path for the StringTemplate group.name- the template name within the StringTemplate group.- Returns:
- the located SQL.
-
findStringTemplate
public static org.stringtemplate.v4.ST findStringTemplate(ClassLoader classLoader, String path, String name) Locates SQL for the given type and name. Loads a StringTemplate group from the resource at the given path, and returns the template with the given name from the group.- Parameters:
classLoader- the classloader from which to load the resource.path- the resource path for the StringTemplate group.name- the template name within the StringTemplate group.- Returns:
- the located SQL.
-
findTemplateInGroup
-
findStringTemplateGroup
Loads the StringTemplateGroup for the given type. Example: Given a typecom.foo.Bar, returns a StringTemplateGroup loaded from the resource namedcom/foo/Bar.sql.stgon the classpath.- Parameters:
type- the type that "owns" the given StringTemplate group file. Dictates the filename of the StringTemplate group file on the classpath.- Returns:
- the loaded StringTemplateGroup.
-
findStringTemplateGroup
Loads the StringTemplateGroup from the given path on the classpath.- Parameters:
path- the resource path on the classpath.- Returns:
- the loaded StringTemplateGroup.
-
findStringTemplateGroup
public static org.stringtemplate.v4.STGroup findStringTemplateGroup(ClassLoader classLoader, String path) Loads the StringTemplateGroup from the given path on the classpath.- Parameters:
classLoader- the classloader from which to load the resource.path- the resource path on the classpath.- Returns:
- the loaded StringTemplateGroup.
-
readStringTemplateGroup
private static org.stringtemplate.v4.STGroup readStringTemplateGroup(ClassLoader classLoader, String path)
-