Ejemplo n.º 1
0
  /**
   * This is used to ensure that for each parameter in the builder there is a matching method or
   * field. This ensures that the class schema is fully readable and writable. If not method or
   * field annotation exists for the parameter validation fails.
   *
   * @param detail contains the details instantiators are built with
   */
  private void validate(Detail detail) throws Exception {
    ParameterMap registry = scanner.getParameters();
    List<Parameter> list = registry.getAll();

    for (Parameter parameter : list) {
      Label label = resolve(parameter);
      String path = parameter.getPath();

      if (label == null) {
        throw new ConstructorException("Parameter '%s' does not have a match in %s", path, detail);
      }
      validateParameter(label, parameter);
    }
    validateConstructors();
  }