com.devonfw.cobigen.api.extension.InputReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core-api Show documentation
Show all versions of core-api Show documentation
A Code-based incremental Generator
The newest version!
package com.devonfw.cobigen.api.extension;
import java.nio.charset.Charset;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.devonfw.cobigen.api.annotation.Cached;
import com.devonfw.cobigen.api.annotation.ExceptionFacade;
import com.devonfw.cobigen.api.exception.InputReaderException;
/**
* This is an extension point to enable further generator input support. Implementations should inherit this interface
* and should be registered via an implemented {@link TriggerInterpreter} to be integrated into the CobiGen generation
* process.
*/
@ExceptionFacade
@Cached
public interface InputReader {
/** Logger instance. */
public static final Logger LOG = LoggerFactory.getLogger(InputReader.class);
/**
* This function will be called if matching triggers or matching templates should be retrieved for a given input
* object
*
* @param input object to be checked
* @return true
if the given input can be processed by the implementing {@link InputReader},
* false
otherwise
*/
public boolean isValidInput(Object input);
/**
* This function should create the FreeMarker object model from the given input
*
* @param input object the model should be build of (not null)
* @return a key to object {@link Map} representing an object model for the generation
*/
public Map createModel(Object input);
/**
* Will return the set of combined input objects if the given input combines multiple input objects.
*
* @param input the combined input object
* @param inputCharset to be used for reading new inputs
* @return a list of input objects, the generation should be triggered for each.
*/
public List