Package org.jdbi.v3.stringtemplate4
Class StringTemplateSqlLocator
- java.lang.Object
-
- org.jdbi.v3.stringtemplate4.StringTemplateSqlLocator
-
public class StringTemplateSqlLocator extends java.lang.ObjectLocates SQL in.sql.stgStringTemplate group files on the classpath.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Map<java.lang.ClassLoader,java.util.Map<java.lang.String,java.lang.ThreadLocal<org.stringtemplate.v4.STGroup>>>CACHE
-
Constructor Summary
Constructors Modifier Constructor Description privateStringTemplateSqlLocator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.stringtemplate.v4.STfindStringTemplate(java.lang.Class<?> type, java.lang.String name)Locates SQL for the given type and name.static org.stringtemplate.v4.STfindStringTemplate(java.lang.ClassLoader classLoader, java.lang.String path, java.lang.String name)Locates SQL for the given type and name.static org.stringtemplate.v4.STfindStringTemplate(java.lang.String path, java.lang.String name)Locates SQL for the given type and name.static org.stringtemplate.v4.STGroupfindStringTemplateGroup(java.lang.Class<?> type)Loads the StringTemplateGroup for the given type.static org.stringtemplate.v4.STGroupfindStringTemplateGroup(java.lang.ClassLoader classLoader, java.lang.String path)Loads the StringTemplateGroup from the given path on the classpath.static org.stringtemplate.v4.STGroupfindStringTemplateGroup(java.lang.String path)Loads the StringTemplateGroup from the given path on the classpath.private static org.stringtemplate.v4.STfindTemplateInGroup(java.lang.String path, java.lang.String name, org.stringtemplate.v4.STGroup group)private static org.stringtemplate.v4.STGroupreadStringTemplateGroup(java.lang.ClassLoader classLoader, java.lang.String path)
-
-
-
Method Detail
-
findStringTemplate
public static org.stringtemplate.v4.ST findStringTemplate(java.lang.Class<?> type, java.lang.String name)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
public static org.stringtemplate.v4.ST findStringTemplate(java.lang.String path, java.lang.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:
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(java.lang.ClassLoader classLoader, java.lang.String path, java.lang.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
private static org.stringtemplate.v4.ST findTemplateInGroup(java.lang.String path, java.lang.String name, org.stringtemplate.v4.STGroup group)
-
findStringTemplateGroup
public static org.stringtemplate.v4.STGroup findStringTemplateGroup(java.lang.Class<?> type)
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
public static org.stringtemplate.v4.STGroup findStringTemplateGroup(java.lang.String path)
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(java.lang.ClassLoader classLoader, java.lang.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(java.lang.ClassLoader classLoader, java.lang.String path)
-
-