org.sqlproc.engine
Class SqlFilesLoader

java.lang.Object
  extended by 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 the SqlProcessorLoader instance creation.

For more info please see the Tutorials.

Author:
Vladimir Hudec

Field Summary
protected  org.slf4j.Logger logger
          The internal slf4j logger.
private  StringBuilder sbStatements
          The string representation of the file(s) content.
 
Constructor Summary
SqlFilesLoader(List<String> fileNames, Class<?> loaderClass)
          Reads the file(s) content and creates a new SqlFilesLoader instance.
SqlFilesLoader(String fileName, Class<?> loaderClass)
          Reads the file(s) content and creates a new SqlFilesLoader instance.
 
Method Summary
 StringBuilder getStatements()
          Returns the content of all read files.
static StringBuilder getStatements(Class<?> loaderClass, String... fileNames)
          Reads the file(s) content and creates a new SqlFilesLoader instance.
static StringBuilder getStatements(Class<?> loaderClass, String fileName)
          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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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.

Constructor Detail

SqlFilesLoader

public SqlFilesLoader(String fileName,
                      Class<?> loaderClass)
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.

SqlFilesLoader

public SqlFilesLoader(List<String> fileNames,
                      Class<?> loaderClass)
Reads the file(s) content and creates a new SqlFilesLoader instance.

Parameters:
fileNames - The names of the files to be read.
loaderClass - Class used to detect the correct classloader.
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

toString

public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object
Returns:
a string representation of the object


Copyright © 2015. All rights reserved.