Package oracle.pgx.config
Class AbstractConfigFactory<T extends AbstractConfig>
- java.lang.Object
-
- oracle.pgx.config.AbstractConfigFactory<T>
-
- Type Parameters:
T
- the type of configuration this factory creates.
- Direct Known Subclasses:
AbstractEntityProviderConfigFactory
,AbstractGraphConfigFactory
public abstract class AbstractConfigFactory<T extends AbstractConfig> extends java.lang.Object
Base factory class for creating configuration objects.
-
-
Constructor Summary
Constructors Constructor Description AbstractConfigFactory()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description T
fromFile(java.io.File file)
Parses a configuration object given as JSON file.T
fromFilePath(java.lang.String path)
Parses a configuration object given as path to a JSON file.T
fromInputStream(java.io.InputStream is)
same asfromInputStream(InputStream, String)
, but withnull
passed as parentPathT
fromInputStream(java.io.InputStream is, java.lang.String parentPath)
Parses a configuration object given an input stream.T
fromJson(java.lang.String json)
Same asfromJson(String, String)
, but withnull
passed as parentPath.T
fromJson(java.lang.String json, java.lang.String parentPath)
Parses a configuration object given a JSON string.T
fromPath(java.lang.String path)
Parses a configuration object given a path.T
fromProperties(java.io.InputStream is)
same asfromProperties(Properties)
, but instantiates a newProperties
object from the givenInputStream
.abstract T
fromProperties(java.util.Properties props)
Parses a configuration object fromProperties
.
-
-
-
Method Detail
-
fromProperties
public abstract T fromProperties(java.util.Properties props)
Parses a configuration object fromProperties
.- Parameters:
props
- the input properties- Returns:
- the configuration object
-
fromPath
public final T fromPath(java.lang.String path) throws java.io.IOException
Parses a configuration object given a path.- Parameters:
path
- the path from where to parse the configuration- Returns:
- the configuration object
- Throws:
java.io.IOException
- if there was any I/O error during reading given path- See Also:
- Path syntax documentation
-
fromInputStream
public final T fromInputStream(java.io.InputStream is, java.lang.String parentPath) throws java.io.IOException
Parses a configuration object given an input stream.- Parameters:
is
- the input stream from where to read the configurationparentPath
- if notnull
, relative paths found in config will resolved against this parentPath- Returns:
- the configuration object
- Throws:
java.io.IOException
- if there was any I/O error during reading given input stream
-
fromInputStream
public final T fromInputStream(java.io.InputStream is) throws java.io.IOException
same asfromInputStream(InputStream, String)
, but withnull
passed as parentPath- Parameters:
is
- the input stream from where to read the configuration- Returns:
- the configuration object
- Throws:
java.io.IOException
- if there was any I/O error during reading given input stream
-
fromJson
public final T fromJson(java.lang.String json, java.lang.String parentPath) throws java.io.IOException
Parses a configuration object given a JSON string.- Parameters:
json
- the input JSON stringparentPath
- if notnull
, relative paths found in config will resolved against this parentPath- Returns:
- the configuration object
- Throws:
java.io.IOException
- if there was any I/O error during reading given JSON string
-
fromJson
public final T fromJson(java.lang.String json) throws java.io.IOException
Same asfromJson(String, String)
, but withnull
passed as parentPath.- Parameters:
json
- the input JSON string- Returns:
- the configuration object
- Throws:
java.io.IOException
- if there was any I/O error during reading given JSON string
-
fromFile
public final T fromFile(java.io.File file) throws java.io.IOException
Parses a configuration object given as JSON file. Relative paths found in JSON are resolved relative to given file.- Parameters:
file
- the input file- Returns:
- the configuration object
- Throws:
java.io.IOException
- if there was any I/O error during reading given file
-
fromFilePath
public final T fromFilePath(java.lang.String path) throws java.io.IOException
Parses a configuration object given as path to a JSON file. Relative paths found in JSON are resolved relative to given file.- Parameters:
path
- the path to the JSON file- Returns:
- the configuration object
- Throws:
java.io.IOException
- if there was any I/O error during reading given file
-
fromProperties
public final T fromProperties(java.io.InputStream is) throws java.io.IOException
same asfromProperties(Properties)
, but instantiates a newProperties
object from the givenInputStream
.- Parameters:
is
- the input stream containing configuration inProperties
format.- Returns:
- the configuration object
- Throws:
java.io.IOException
- if there was any I/O error during reading given input stream
-
-