Package net.obvj.confectory.source
Class SourceFactory
- java.lang.Object
-
- net.obvj.confectory.source.SourceFactory
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Source<T>classpathFileSource(String path)Creates a newClasspathFileSourcefor loading a local file resource from the Java classpath.static <T> Source<T>dynamicSource(String path)Creates a newDynamicSource.static <T> Source<T>fileSource(String path)Creates a newFileSourcefor loading a local file from the file system.static <T> Source<T>stringSource(String string)Creates a newStringSourcefor loading contents of aString.static <T> Source<T>urlSource(String url)Creates a newURLSourcefor loading contents of a URL.
-
-
-
Method Detail
-
fileSource
public static <T> Source<T> fileSource(String path)
Creates a newFileSourcefor loading a local file from the file system.The path may contain system environment variables, which must be placed between
"${"and"}". For example:"${TEMP}/file.txt".- Type Parameters:
T- the target return type- Parameters:
path- the file path- Returns:
- a
FileSource
-
classpathFileSource
public static <T> Source<T> classpathFileSource(String path)
Creates a newClasspathFileSourcefor loading a local file resource from the Java classpath.- Type Parameters:
T- the target return type- Parameters:
path- the relative path to the source file in the Java classpath- Returns:
- a
ClasspathFileSource
-
dynamicSource
public static <T> Source<T> dynamicSource(String path)
Creates a newDynamicSource.- Type Parameters:
T- the target return type- Parameters:
path- the path to the dynamic resource- Returns:
- a
DynamicSource
-
stringSource
public static <T> Source<T> stringSource(String string)
Creates a newStringSourcefor loading contents of aString.- Type Parameters:
T- the target return type- Parameters:
string- the string to be parsed- Returns:
- a
StringSource
-
-