Skip to content

Allow setting a validator class for an option. #37

@jarrodhroberson

Description

@jarrodhroberson

I would like to register a class to apply to the value of an option.

Implementations of the following interface would allow extremely flexible pre-validation without having to add this noise to your code and would allow better reuse of common validations.

public interface OptionValidator<T>
{
    public boolean isValid(@Nullable final T value);
    @Nonnull
    public String getErrorMessage();
}

If you could point me to where this should be added in I can write it and submit a pull request, but the indirection is obfuscating where this would go.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions