Package org.sqlproc.engine
Class SqlFilesLoader
- java.lang.Object
-
- org.sqlproc.engine.SqlFilesLoader
-
public class SqlFilesLoader extends Object
The helper class for the file(s) loading. The file(s) can be located on the classpath, in the root directory or in the user's home directory. It's used for the purpose of theSqlProcessorLoader
instance creation.For more info please see the Tutorials.
- Author:
- Vladimir Hudec
-
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.Logger
logger
The internal slf4j logger.private StringBuilder
sbStatements
The string representation of the file(s) content.
-
Constructor Summary
Constructors Constructor Description SqlFilesLoader(String fileName, Class<?> loaderClass)
Reads the file(s) content and creates a new SqlFilesLoader instance.SqlFilesLoader(List<String> fileNames, Class<?> loaderClass)
Reads the file(s) content and creates a new SqlFilesLoader instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringBuilder
getStatements()
Returns the content of all read files.static StringBuilder
getStatements(Class<?> loaderClass, String fileName)
Reads the file(s) content and creates a new SqlFilesLoader instance.static StringBuilder
getStatements(Class<?> loaderClass, String... fileNames)
Reads the file(s) content and creates a new SqlFilesLoader instance.private StringBuilder
load(String fileName, Class<?> loaderClass)
Reads the file content and creates a String representation of this content.String
toString()
Returns a string representation of the object.
-
-
-
Field Detail
-
logger
protected final org.slf4j.Logger logger
The internal slf4j logger.
-
sbStatements
private StringBuilder sbStatements
The string representation of the file(s) content.
-
-
Method Detail
-
getStatements
public static StringBuilder getStatements(Class<?> loaderClass, String fileName)
Reads the file(s) content and creates a new SqlFilesLoader instance.- Parameters:
fileName
- The name of the file to be read.loaderClass
- Class used to detect the correct classloader.- Returns:
- the content of the specified file(s) as a String
-
getStatements
public static StringBuilder getStatements(Class<?> loaderClass, String... fileNames)
Reads the file(s) content and creates a new SqlFilesLoader instance.- Parameters:
fileNames
- The name sof the files to be read.loaderClass
- Class used to detect the correct classloader.- Returns:
- the content of the specified file(s) as a String
-
load
private StringBuilder load(String fileName, Class<?> loaderClass)
Reads the file content and creates a String representation of this content.- Parameters:
fileName
- The name of the file to be read.loaderClass
- Class used to detect the correct classloader.- Returns:
- the content of the specified file as a String
-
getStatements
public StringBuilder getStatements()
Returns the content of all read files.- Returns:
- the content of all read files
-
-