Class 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.
    • Constructor Detail

      • AbstractLoader

        public AbstractLoader​(java.lang.ClassLoader classloader,
                              AbstractLoader.ErrorHandler errorHandler)
        Parameters:
        classloader - ClassLoader from which candidates classes are loaded
        errorHandler - 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 properties
        type - 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 name
        type - 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 line
        description - description of the class
        type - type of the candidate