/** * Check if a given OptionDescriptor describes a date option. That is the case if * the descriptors argument converter is of type DateConverter. * * @param descriptor the descriptor to check * @return true if the discriptor describes a date option, false otherwise */ private boolean isDateOption( OptionDescriptor descriptor ) { boolean isDateOption = false; Optional<ValueConverter<?>> valueConverterOptional = descriptor.argumentConverter(); if ( valueConverterOptional.isPresent() ) { ValueConverter<?> valueConverter = valueConverterOptional.get(); if ( DateConverter.class.isInstance( valueConverter ) ) { isDateOption = true; } } return isDateOption; }
.map( v -> descriptor.argumentConverter() .map( c -> c.revert( v ) ) .orElse( String.valueOf( v ) ) )