- All Implemented Interfaces:
Serializable
,Comparable<JStacheType>
,Constable
Tells the annotation processor what kind of code to generate namely whether to generate
full fledged jstachio templates (default
Class that are generated with type
JSTACHIO
) or zero
dependency templates (STACHE
).
JStachio will guarantee to generate the following methods for this specific major version (this will only change on major version changes):
Type | Method | Description |
---|---|---|
JSTACHIO STACHE |
<T extends Model> void execute(T model, Appendable appendable) |
Executes model |
JSTACHIO |
<T extends Model> void execute(T model, Appendable appendable, Formatter formatter, Escaper escaper) |
Executes model with supplied formatter and escaper |
JSTACHIO STACHE |
Class<?> modelClass() |
Return the model class (root context class annotated with JStache) that generated this template. |
JSTACHIO STACHE |
this() |
No arg constructor that will resolve the formatter and escaper based on configuration. |
JSTACHIO STACHE |
this(Function<@Nullable Object,String> formatter, Function<String,String> escaper) |
Constructor that uses the supplied formatter and escaper for
execute(T model, Appendable appendable) . |
JSTACHIO |
this(TemplateConfig templateConfig) |
Constructor that configures a JStachio template based on configuration. |
JSTACHIO STACHE |
public static GENERATED_CLASS of() |
Similar to the no arg constructor but reuses a single static singleton. |
Class that are generated with type
JSTACHIO
will implement
io.jstach.jstachio.Template
interface and thus all methods on that interface
(and parent interfaces) will be generated if needed (ie no default method).- Author:
- agentgt
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionThe default code generation which allows reflective access to templates and requires the jstachio runtime (io.jstach.jstachio).Zero runtime dependency renderers are generated if this is selected.This effectively means not set and to let otherJStacheConfig
determine the setting. -
Method Summary
Modifier and TypeMethodDescriptionstatic JStacheType
Returns the enum constant of this class with the specified name.static JStacheType[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
UNSPECIFIED
This effectively means not set and to let otherJStacheConfig
determine the setting. -
JSTACHIO
The default code generation which allows reflective access to templates and requires the jstachio runtime (io.jstach.jstachio). -
STACHE
Zero runtime dependency renderers are generated if this is selected. Code will not have a single reference to JStachio runtime interfaces.Because there is no reference to the JStachio runtime the escaper and formatter are inline implementations that passthrough the result of
Object.toString()
directly to the appendable. Just like JStachios default formatter anull
variable will fail fast with a null pointer exception. If you need different escaping or formatting you will have to provide your own implementation!If all templates in a project are generated this way then you can and ideally should set:
- The
jstachio-annotation
dependency as an optional dependency (e.g. in Maven<optional>true</optional>
) - as well as set in your module-info
requires static io.jstach.jstache
.
- API Note
- if this is selected jstachio runtime extensions will not work for the generated renderers.
- The
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-