net.markenwerk.commons.interfaces.Processor Maven / Gradle / Ivy
/*
* Copyright (c) 2015 Torsten Krause, Markenwerk GmbH
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package net.markenwerk.commons.interfaces;
import net.markenwerk.commons.exceptions.ProcessingException;
/**
* A {@link Processor} is used to process (transform, translate, project,
* evaluate, ...) values.
*
*
* @param
* The type of the involved values.
* @author Torsten Krause (tk at markenwerk dot net)
* @since 4.0.0
*/
public interface Processor {
/**
* Called to process a given value.
*
*
* Implementers should catch any exception and wrap them in a
* {@link ProcessingException}.
*
*
* Depending on the use case, if the given value {@literal null}, the
* {@link Processor} should return {@literal null}.
*
*
* It lies in the responsibility of the caller, to handle unwanted
* {@literal null}-values by replacing them with a sensible default value or
* throwing an appropriate {@link ProcessingException}.
*
* @param value
* The value to be processed.
* @return The processed value.
* @throws ProcessingException
* If the conversion failed.
*/
public Value process(Value value) throws ProcessingException;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy