- All Implemented Interfaces:
Serializable
,Comparable<JStacheFlags.Flag>
,Constable
- Enclosing class:
- JStacheFlags
Compiler flags. Besides setting with
JStacheFlags
the flags are also
available as annotation processor options but are prefixed with
"jstache.
" and lowercased
For example DEBUG
would be: -Ajstache.debug=true/false
- Author:
- agentgt
- API Note
- SUBJECT TO CHANGE!
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionWill always bind "@context" with a empty ContextNode.This will produce additional logging that is sent to standard out while the annotation processor runs (not during runtime).Per mustache spec dotted names can actually not exist at all for inverted sections.EXPERIMENTAL: Normally falsey is either empty list, boolean false, ornull
.If set the templates will NOT have pre-encoded bytes of the static parts of the template and the generatedJStacheType.JSTACHIO
code will not implementio.jstach.jstachio.Template.EncodedTemplate
.Flag to indicate nothing is set. -
Method Summary
Modifier and TypeMethodDescriptionstatic JStacheFlags.Flag
Returns the enum constant of this class with the specified name.static JStacheFlags.Flag[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
UNSPECIFIED
Flag to indicate nothing is set. This is to differentiate a request to unsetJStacheFlags.flags()
flags vs ignore and cascade up. SeeJStacheConfig
for config cascading.- See Also:
-
DEBUG
This will produce additional logging that is sent to standard out while the annotation processor runs (not during runtime). -
NO_INVERTED_BROKEN_CHAIN
Per mustache spec dotted names can actually not exist at all for inverted sections. This flag disables that so that a compiler failure will happen if the fields are missing. For example assume "missing" is not present on "data" as in data has no field or method called "missing".{{^data.missing}} {{/data.missing}}
Normally the above will compile just fine per the spec but this can lead to bugs. To not allow what the spec calls "dotted broken chains" you can use this flag. -
NO_NULL_CHECKING
EXPERIMENTAL: Normally falsey is either empty list, boolean false, ornull
. This flag disablesnull
as a falsey check. For example when opening a section like:
JStachio would produce code that checks if{{#myNonNull}} Hi! {{/myNonNull}}
myNonNull
is null as well as iterate if it is a list or check if true if it is a boolean.However null checking will still be done if JStachio can find a
ElementType.TYPE_USE
annotation with theClass.getSimpleName()
ofNullable
on the type that is being accessed as a section. This follows JSpecify rules but not other nullable annotations like SpotBugs that are notElementType.TYPE_USE
.Benefits
The advantages of disabling null checking are:- Failing fast instead of just not rendering something which may make finding bugs easier.
- Less generated code which maybe easier to read
- Avoid warnings of superfluous null checking by static analysis tools
- Possible slight improvement of performance
Caveats
JDK Bug
Because of JDK bug: JDK-8225377 this nullable detection will only work if the type that is being checked is currently within the same compile boundary as the JStache model being analyzed!Manually checking for null
If JStachio cannot detect that the type is nullable because it is not annotated or because of the aforementioned JDK bug then it will conclude that it can never be null and thus you will be unable to use section like conditions to check if is null. One workaround is to use a customJStacheLambda
to check for null.- API Note
- This is currently experimental and a flag because of the JDK bug. In
the future more comprehensive support will be put in
JStacheConfig
.
-
PRE_ENCODE_DISABLE
If set the templates will NOT have pre-encoded bytes of the static parts of the template and the generatedJStacheType.JSTACHIO
code will not implementio.jstach.jstachio.Template.EncodedTemplate
. -
CONTEXT_SUPPORT_DISABLE
Will always bind "@context" with a empty ContextNode.
-
-
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
-