Class ConditionTemplate
java.lang.Object
de.japkit.test.members.common.condition.ConditionTemplate
@Clazz(commentExpr="The generated class for the example.")
@RuntimeMetadata
public abstract class ConditionTemplate
extends java.lang.Object
Class members can be generated conditionally by setting cond or condFun.
In this template, the member are generated if the trigger annotation value shallGenerateMembers, which is provided as EL variable, is set to true. Any boolean expressions or functions can be used as conditions.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
ConditionTemplate.someFunction
This function evaluates to true if the trigger annotation value shallGenerateMembers is set to true.static class
ConditionTemplate.SomeInnerClass
This inner class is generated if the function someFunction evaluates to true.(package private) class
ConditionTemplate.SomeTemplate
If multiple members have the same condition, they can be grouped in a template with that condition. -
Field Summary
Fields Modifier and Type Field Description java.lang.String
someField1
This field is generated if cond evaluates to true.java.lang.String
someField2
The condition is evaluated before the src variable (seeSourceTemplate
) is set. -
Constructor Summary
Constructors Constructor Description ConditionTemplate()
-
Method Summary
Modifier and Type Method Description abstract java.lang.String
someMethod()
This method is generated if cond evaluates to true.
-
Field Details
-
someField1
@Field(cond="#{shallGenerateMembers}") public java.lang.String someField1This field is generated if cond evaluates to true. This is the case when the trigger annotation value shallGenerateMembers is set to true. -
someField2
@Field(cond="#{src.simpleName == \'ConditionExampleTrue\'}", src="#{\'fooBar\'}") public java.lang.String someField2The condition is evaluated before the src variable (seeSourceTemplate
) is set. So if the src variable is used in the condition it will be the one of the surrounding template.So, "someField2" will be generated, if the src name is "ConditionExampleTrue" which is exactly the case if that is the name of the annotated class, which is the src of this
ConditionTemplate
.
-
-
Constructor Details
-
ConditionTemplate
public ConditionTemplate()
-
-
Method Details
-
someMethod
@Method(cond="#{shallGenerateMembers}", bodyCode="return null;") public abstract java.lang.String someMethod()This method is generated if cond evaluates to true. This is the case when the trigger annotation value shallGenerateMembers is set to true.
-