org.infinispan.cli.converters.NullableIntegerConverter Maven / Gradle / Ivy
package org.infinispan.cli.converters;
import org.aesh.command.converter.Converter;
import org.aesh.command.converter.ConverterInvocation;
/**
* @author Tristan Tarrant <[email protected]>
* @since 11.0
**/
public class NullableIntegerConverter implements Converter {
@Override
public Integer convert(ConverterInvocation invocation) {
String input = invocation.getInput();
return input == null || input.isEmpty() ? null : Integer.parseInt(input);
}
}