Skip to content

Dependency

Parag Jain edited this page Jul 18, 2019 · 1 revision

Dependency

  • You can download the latest jar from jar
  • Maven dependency:(Not a published library, it has to be built in the system before adding the dependency)
<dependency>
	<groupId>com.twig.template.core</groupId>
	<artifactId>twig-template-core</artifactId>
	<version>0.0.1-SNAPSHOT</version>
</dependency>

Driver class is TwigTemplateDriver

import com.twig.template.core.processor.TwigTemplateDriver
templateDriver.getNLGFromJsonString(inputJson)

Example usage :

import com.twig.template.core.exceptions.TwigTemplateException;
import com.twig.template.core.processor.InputProcessor;
import com.twig.template.core.processor.TwigTemplateDriver;
import com.twig.template.core.util.FileProcess;

public class Test {

	private static final String TEST_TEMPLATE_FILE = "resources/testfiles/test-templates.json";

	public static void main(String[] args) {
		String jsonInput = FileProcess.readFile("resources/testfiles/discount-template-input.json");
		String tempDef = FileProcess.readFile(TEST_TEMPLATE_FILE);
		TwigTemplateDriver driver = new TwigTemplateDriver(tempDef);
		String o;
		try {
			o = driver.getNLGFromJsonString(jsonInput);
			System.out.println(o);
		} catch (TwigTemplateException e) {
			e.printStackTrace();
		}

	}

}

Clone this wiki locally