public ParameterTool applyTo(ParameterTool parameterTool) throws RequiredParametersException {
		List<String> missingArguments = new LinkedList<>();

		HashMap<String, String> newParameters = new HashMap<>(parameterTool.toMap());

		for (Option o : data.values()) {
			if (newParameters.containsKey(o.getName())) {
				if (Objects.equals(newParameters.get(o.getName()), ParameterTool.NO_VALUE_KEY)) {
					// the parameter has been passed, but no value, check if there is a default value
					checkAndApplyDefaultValue(o, newParameters);
				} else {
					// a value has been passed in the parameterTool, now check if it adheres to all constraints
					checkAmbiguousValues(o, newParameters);
					checkIsCastableToDefinedType(o, newParameters);
					checkChoices(o, newParameters);
				}
			} else {
				// check if there is a default name or a value passed for a possibly defined alternative name.
				if (hasNoDefaultValueAndNoValuePassedOnAlternativeName(o, newParameters)) {
					missingArguments.add(o.getName());
				}
			}
		}
		if (!missingArguments.isEmpty()) {
			throw new RequiredParametersException(this.missingArgumentsText(missingArguments), missingArguments);
		}

		return ParameterTool.fromMap(newParameters);
	}
public ParameterTool applyTo ( ParameterTool parameterTool ) throws RequiredParametersException { List < String > missingArguments = new LinkedList < > ( ) ; HashMap < String , String > newParameters = new HashMap < > ( parameterTool . toMap ( ) ) ; for ( Option o : data . values ( ) ) { if ( newParameters . containsKey ( o . getName ( ) ) ) { if ( Objects . equals ( newParameters . get ( o . getName ( ) ) , ParameterTool . NO_VALUE_KEY ) ) { checkAndApplyDefaultValue ( o , newParameters ) ; } else { checkAmbiguousValues ( o , newParameters ) ; checkIsCastableToDefinedType ( o , newParameters ) ; checkChoices ( o , newParameters ) ; } } else { if ( hasNoDefaultValueAndNoValuePassedOnAlternativeName ( o , newParameters ) ) { missingArguments . add ( o . getName ( ) ) ; } } } if ( ! missingArguments . isEmpty ( ) ) { throw new RequiredParametersException ( this . missingArgumentsText ( missingArguments ) , missingArguments ) ; } return ParameterTool . fromMap ( newParameters ) ; }
Check for all required parameters defined:
- has a value been passed
- if not, does the parameter have an associated default value
- does the type of the parameter match the one defined in RequiredParameters
- does the value provided in the parameterTool adhere to the choices defined in the option.

<p>If any check fails, a RequiredParametersException is thrown

@param parameterTool - parameters supplied by the user.
@return the updated ParameterTool containing all the required parameters
@throws RequiredParametersException if any of the specified checks fail