class KeyConfigurationValidator implements ConstraintValidator<ValidKeyConfiguration, KeyConfiguration> {

    @Override
    public boolean isValid(KeyConfiguration keyConfiguration, ConstraintValidatorContext cvc) {

        return keyConfiguration==null || !(keyConfiguration.getPasswordFile()!=null && keyConfiguration.getPasswords()!=null);

    }

}