All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.codefilarete.tool.function.Converter Maven / Gradle / Ivy

package org.codefilarete.tool.function;

/**
* @author Guillaume Mary
*/
@FunctionalInterface
public interface Converter extends ThrowingConverter {
	
	abstract class NullAwareConverter implements Converter {
		
		@Override
		public O convert(I input) {
			return input == null ? convertNull() : convertNotNull(input);
		}
		
		/**
		 * Called for returning a value when input is null.
		 * This implementation returns null
		 * 
		 * @return whatever needed
		 */
		protected O convertNull() {
			return null;
		}
		
		protected abstract O convertNotNull(I input);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy