Package fileLogic
Class Loader<T extends Collection<E>,E>
java.lang.Object
fileLogic.Loader<T,E>
- Type Parameters:
T
- Collection to fillE
- Type of collection elements
Abstract loader class. It uses
java.lang.reflect
API for changing fields taken from XML file
and converted by java.beans.PropertyEditor
. It fills Elements of type E to collection of type T- Since:
- 1.0
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionloadFromFile
(String path, BaseReader reader) Abstract method to read any collection from any file by any reader.loadFromXMLbyEnvKey
(String envKey) Fill collection with elements from XML file.static void
setupConverter
(Class<?> typeToEdit, Class<? extends PropertyEditor> editor) Manually register editor for your datatype.
-
Constructor Details
-
Loader
Initializer of fileLogic.Loader class.- Parameters:
tClass
- Class ofT
. Should be provided due to Java's generic types restriction.eClass
- Class ofE
. Should be provided due to Java's generic types restriction.
-
-
Method Details
-
setupConverter
Manually register editor for your datatype. Call this method before parsing XML.- Parameters:
typeToEdit
- Type to register in editoreditor
- Editor of type. Should implement PropertyEditor interface- See Also:
-
loadFromXMLbyEnvKey
Fill collection with elements from XML file. XML filepath will be taken from Environment variable- Parameters:
envKey
- Key of System env. var to XML filepath- Returns:
- Filled collection of type T
-
loadFromFile
Abstract method to read any collection from any file by any reader.- Parameters:
path
- Path to filereader
- File reader- Returns:
- Collection with elements matched by file
-