Ejemplo n.º 1
0
 /**
  * Gets an instance of the config, sets the fields and validates them. The method sets up the
  * configuration by loading properties and parsing command line arguments, then tries to find a
  * constructor of the config class that matches the arguments passed to it, instantiates the
  * config class, sets its fields and validates the instance.
  *
  * @param objects a vararg of Objects passed to a corresponding constructor of the config class.
  * @return An instance of the config class.
  */
 public T build(Object... objects) {
   initializeErrorMessageSetup(propertyLoader);
   setupBuilderConfiguration(propertyLoader);
   T instanceOfConfigClass = constructionHelper.getInstance(configClass, objects);
   fieldSetter.setFields(instanceOfConfigClass, builderConfiguration);
   configValidator.validate(instanceOfConfigClass);
   return instanceOfConfigClass;
 }