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

de.schlegel11.lambdadecor.LambdaDecor Maven / Gradle / Ivy

There is a newer version: 1.2
Show newest version
package de.schlegel11.lambdadecor;

import java.util.function.Function;

/**
 * Class that holds a {@link Behaviour} type with a specific type {@link T}.
 *
 * @param  type for this behaviour
 * @author Marcel Schlegel (schlegel11)
 * @since 1.0
 */
public interface LambdaDecor {

    /**
     * Updates the held {@link Behaviour}.
     *
     * @param behaviour {@link Function} that provides the currently hold {@link Behaviour} and returns the updated {@link Behaviour}
     * @return this {@link LambdaDecor} object
     * @throws NullPointerException if the {@code behaviour} is null or the return value if the {@link Function} is null
     */
    LambdaDecor updateBehaviour(Function, Behaviour> behaviour);

    /**
     * Applies this {@link Behaviour} to the given type {@link T}.
     *
     * @param type specific type {@link T}
     * @return type {@link T} object after applying all {@link Behaviour}s
     */
    T apply(T type);

    /**
     * Performs the specific {@link Unappliable} operation of this {@link Behaviour}.
     */
    void unapply();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy