templates.java.hook.liquid Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of recipe-generator Show documentation
Show all versions of recipe-generator Show documentation
Generates ingredients and implementation hooks for the Recipe framework
{%- if options.javaPackage != "" -%}
package {{options.javaPackage}};
{% endif %}
import ca.derekcormier.recipe.BaseIngredientHook;
import ca.derekcormier.recipe.Cake;
{% assign className = 'Abstract' | append: ingredient.name -%}
{%- assign className = className | append: 'Hook' -%}
{%- assign dataClassName = ingredient.name | append: 'Data' -%}
public abstract class {{className}} extends BaseIngredientHook<{{dataClassName}}> {
{%- for key in info.constantKeys %}
public static String {{key}} = "{{info.constantValues[forloop.index0]}}";
{% endfor %}
public {{className}}() {
super("{{ingredient.name}}", {{dataClassName}}.class);
}
public abstract void bake({{dataClassName}} data, Cake cake);
}