001package org.intellimate.izou.output;
002
003import com.google.common.reflect.TypeToken;
004import org.intellimate.izou.events.EventModel;
005import org.intellimate.izou.identification.Identifiable;
006
007/**
008 * OutputExtension's purpose is to take resourceData and convert it into another data format so that it can be rendered correctly
009 * by the output-plugin. These objects are represented in the form of future objects that are stored in tDoneList
010 */
011public interface OutputExtensionModel<X, T> extends Identifiable {
012    /**
013     * Checks if the outputExtension can execute with the current event
014     *
015     * @param event the event to check
016     * @return the state of whether the outputExtension can execute with the current event
017     */
018    boolean canRun(EventModel event);
019
020    /**
021     * Gets the id of the output-plugin the outputExtension belongs to
022     *
023     * @return id of the output-plugin the outputExtension belongs to
024     */
025    String getPluginId();
026
027    /**
028     * generates the data for the given Event
029     * @param event the event to generate for
030     * @param t the optional argument
031     * @return the result
032     */
033    X generate(EventModel event, T t);
034
035    /**
036     * returns the ReturnType of the generic
037     * @return the type of the generic
038     */
039    //i don't think there is another way
040    TypeToken<X> getReturnType();
041
042    /**
043     * returns the Type of the Argument or null if none
044     * @return the type of the argument
045     */
046    //i don't think there is another way
047    TypeToken<T> getArgumentType();
048}