public long getLong(List<String> keyAliases, long defaultValue, Predicate<Long> constraint,
        String message) {

        AliasValueEntry candidate = getValue(keyAliases);
        if (candidate == null || StringUtils.isBlank(candidate.value)) {
            return defaultValue;
        }
        try {
            long parsedInt = Long.parseLong(candidate.value);
            if (!constraint.test(parsedInt)) {
                throw InvalidOptionConfigurationException
                    .constraintFailure(candidate.alias, "long", candidate.value, message);
            }
            return parsedInt;
        } catch (NumberFormatException nfe) {
            throw InvalidOptionConfigurationException.parseFailure(candidate.alias, "long", candidate.value, nfe);
        }
    }
Parse an integer from the options using the key aliases.

@param keyAliases   the key aliases
@param defaultValue the default value
@param constraint   the constraint that the value should obey
@param message      a human-readable message to describe the constraint and display in the case of a
                    constraint violation.
@return the parsed long, or the default value if none found
@throws InvalidOptionConfigurationException if a value is not a valid long, or a constraint violation
                                        occurs (e.g. {@code X > 5}).
common/config/src/main/java/io/apiman/common/config/options/GenericOptionsParser.java