Package org.jdbi.v3.sqlobject.locator
Class SqlObjectClasspathSqlLocator
- java.lang.Object
-
- org.jdbi.v3.sqlobject.locator.SqlObjectClasspathSqlLocator
-
- All Implemented Interfaces:
SqlLocator
public class SqlObjectClasspathSqlLocator extends java.lang.Object implements SqlLocator
Locates SQL in.sqlfiles on the classpath for use withSqlQuery. Given a class and method name, for examplecom.foo.Bar#query, load a classpath resource name likecom/foo/Bar/query.sqland use it with the annotation. The contents are then parsed, cached, and returned for use by a statement.- See Also:
ClasspathSqlLocator
-
-
Field Summary
Fields Modifier and Type Field Description private ClasspathSqlLocatorlocator
-
Constructor Summary
Constructors Constructor Description SqlObjectClasspathSqlLocator()Creates a new SqlObjectClasspathSqlLocator.SqlObjectClasspathSqlLocator(ClasspathSqlLocator locator)Creates a new SqlObjectClasspathSqlLocator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringlocate(java.lang.Class<?> sqlObjectType, java.lang.reflect.Method method, ConfigRegistry config)Locates and returns the SQL for the given SQL Object type and method.
-
-
-
Field Detail
-
locator
private final ClasspathSqlLocator locator
-
-
Constructor Detail
-
SqlObjectClasspathSqlLocator
public SqlObjectClasspathSqlLocator()
Creates a new SqlObjectClasspathSqlLocator. Uses aClasspathSqlLocatorinstance that strips comments off.
-
SqlObjectClasspathSqlLocator
public SqlObjectClasspathSqlLocator(ClasspathSqlLocator locator)
Creates a new SqlObjectClasspathSqlLocator.- Parameters:
locator- AClasspathSqlLocatorinstance
-
-
Method Detail
-
locate
public java.lang.String locate(java.lang.Class<?> sqlObjectType, java.lang.reflect.Method method, ConfigRegistry config)Description copied from interface:SqlLocatorLocates and returns the SQL for the given SQL Object type and method.- Specified by:
locatein interfaceSqlLocator- Parameters:
sqlObjectType- the SQL object typemethod- the methodconfig- the config registry- Returns:
- the SQL for the given method.
-
-