Package org.objenesis.tck
Class AbstractLoader
- java.lang.Object
-
- org.objenesis.tck.AbstractLoader
-
public abstract class AbstractLoader extends java.lang.Object
Class loading a property file and delegating the treatment of each line to a concrete implementations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
AbstractLoader.ErrorHandler
Handler for reporting errors from the AbstractLoader.static class
AbstractLoader.LoggingErrorHandler
Error handler that logs errors to a text stream.
-
Constructor Summary
Constructors Constructor Description AbstractLoader(java.lang.ClassLoader classloader, AbstractLoader.ErrorHandler errorHandler)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
handlePropertyEntry(java.lang.Class<?> clazz, java.lang.String description, Candidate.CandidateType type)
Will receive one class and its description pairs from the filevoid
loadFrom(java.io.InputStream inputStream, Candidate.CandidateType type)
void
loadFromResource(java.lang.String resource, Candidate.CandidateType type)
Load a candidate property file
-
-
-
Constructor Detail
-
AbstractLoader
public AbstractLoader(java.lang.ClassLoader classloader, AbstractLoader.ErrorHandler errorHandler)
- Parameters:
classloader
- ClassLoader from which candidates classes are loadederrorHandler
- Handler called in case of error
-
-
Method Detail
-
loadFrom
public void loadFrom(java.io.InputStream inputStream, Candidate.CandidateType type) throws java.io.IOException
- Parameters:
inputStream
- Stream containing the propertiestype
- Type of the candidate loaded from the stream- Throws:
java.io.IOException
- If something goes wrong while reading the stream
-
loadFromResource
public void loadFromResource(java.lang.String resource, Candidate.CandidateType type) throws java.io.IOException
Load a candidate property file- Parameters:
resource
- File nametype
- Type of the candidate loaded from the stream- Throws:
java.io.IOException
- If there's problem reading the file
-
handlePropertyEntry
protected abstract void handlePropertyEntry(java.lang.Class<?> clazz, java.lang.String description, Candidate.CandidateType type)
Will receive one class and its description pairs from the file- Parameters:
clazz
- class on the linedescription
- description of the classtype
- type of the candidate
-
-