Class SqlObjectClasspathSqlLocator

  • All Implemented Interfaces:
    SqlLocator

    public class SqlObjectClasspathSqlLocator
    extends java.lang.Object
    implements SqlLocator
    Locates SQL in .sql files on the classpath for use with SqlQuery. Given a class and method name, for example com.foo.Bar#query, load a classpath resource name like com/foo/Bar/query.sql and use it with the annotation. The contents are then parsed, cached, and returned for use by a statement.
    See Also:
    ClasspathSqlLocator
    • Constructor Detail

      • SqlObjectClasspathSqlLocator

        public SqlObjectClasspathSqlLocator()
        Creates a new SqlObjectClasspathSqlLocator. Uses a ClasspathSqlLocator instance that strips comments off.
      • SqlObjectClasspathSqlLocator

        public SqlObjectClasspathSqlLocator​(ClasspathSqlLocator locator)
        Creates a new SqlObjectClasspathSqlLocator.
        Parameters:
        locator - A ClasspathSqlLocator instance
    • Method Detail

      • locate

        public java.lang.String locate​(java.lang.Class<?> sqlObjectType,
                                       java.lang.reflect.Method method,
                                       ConfigRegistry config)
        Description copied from interface: SqlLocator
        Locates and returns the SQL for the given SQL Object type and method.
        Specified by:
        locate in interface SqlLocator
        Parameters:
        sqlObjectType - the SQL object type
        method - the method
        config - the config registry
        Returns:
        the SQL for the given method.