Package org.drools.drl.ast.dsl.impl
Class RuleDescrBuilderImpl
java.lang.Object
org.drools.drl.ast.dsl.impl.BaseDescrBuilderImpl<PackageDescrBuilder,RuleDescr>
org.drools.drl.ast.dsl.impl.RuleDescrBuilderImpl
- All Implemented Interfaces:
AnnotatedDescrBuilder<RuleDescrBuilder>,AttributeSupportBuilder<RuleDescrBuilder>,DescrBuilder<PackageDescrBuilder,,RuleDescr> RuleDescrBuilder
public class RuleDescrBuilderImpl
extends BaseDescrBuilderImpl<PackageDescrBuilder,RuleDescr>
implements RuleDescrBuilder
A descr builder for Rules
-
Field Summary
Fields inherited from class org.drools.drl.ast.dsl.impl.BaseDescrBuilderImpl
descr, parent -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a new attribute to the statementAdds a new attribute with the given name and valueattribute(String name, String value, AttributeDescr.Type type) Adds a new attribute with the given name and valueextendsRule(String name) Defines the name of the rule this rule extends.lhs()Defines the LHS (condition) of the rule.The name of the rule.An additional named right hand side (consequence) of the rule.newAnnotation(String name) The default right hand side (consequence) of the rule.Methods inherited from class org.drools.drl.ast.dsl.impl.BaseDescrBuilderImpl
end, endCharacter, endLocation, getDescr, getParent, startCharacter, startLocationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.drools.drl.ast.dsl.DescrBuilder
end, endCharacter, endLocation, getDescr, getParent, startCharacter, startLocation
-
Constructor Details
-
RuleDescrBuilderImpl
-
-
Method Details
-
newAnnotation
- Specified by:
newAnnotationin interfaceAnnotatedDescrBuilder<RuleDescrBuilder>
-
attribute
Description copied from interface:AttributeSupportBuilderAdds a new attribute to the statement- Specified by:
attributein interfaceAttributeSupportBuilder<RuleDescrBuilder>- Parameters:
name- the attribute name- Returns:
- the AttributeDescrBuilder to set the attribute value
-
name
Description copied from interface:RuleDescrBuilderThe name of the rule. Best practice is to keep rule names relatively short, i.e. under 60 characters.- Specified by:
namein interfaceRuleDescrBuilder- Parameters:
name- name of the rule- Returns:
- itself
-
extendsRule
Description copied from interface:RuleDescrBuilderDefines the name of the rule this rule extends. It will cause the rule to inherit the LHS from the parent rule.- Specified by:
extendsRulein interfaceRuleDescrBuilder- Parameters:
name- name of the parent rule- Returns:
- itself
-
rhs
Description copied from interface:RuleDescrBuilderThe default right hand side (consequence) of the rule. This is a code block that must be valid according to the used dialect (java or MVEL). In particular, the deprecated '#' character, that was used for one line comments is not supported. For one line comments, please use standard '//'.- Specified by:
rhsin interfaceRuleDescrBuilder- Parameters:
rhs- the code block- Returns:
- itself
-
namedRhs
Description copied from interface:RuleDescrBuilderAn additional named right hand side (consequence) of the rule. This is a code block that must be valid according to the used dialect (java or MVEL). In particular, the deprecated '#' character, that was used for one line comments is not supported. For one line comments, please use standard '//'.- Specified by:
namedRhsin interfaceRuleDescrBuilder- Parameters:
name- the name of the consequencerhs- the code block- Returns:
- itself
-
lhs
Description copied from interface:RuleDescrBuilderDefines the LHS (condition) of the rule.- Specified by:
lhsin interfaceRuleDescrBuilder- Returns:
- a Conditional Element descriptor builder with the AND CE semantic.
-
attribute
Description copied from interface:AttributeSupportBuilderAdds a new attribute with the given name and value- Specified by:
attributein interfaceAttributeSupportBuilder<RuleDescrBuilder>- Parameters:
name- the name of the attribute to be addedvalue- the value of the attribute to be added- Returns:
- the container builder
-
attribute
Description copied from interface:AttributeSupportBuilderAdds a new attribute with the given name and value- Specified by:
attributein interfaceAttributeSupportBuilder<RuleDescrBuilder>- Parameters:
name- the name of the attribute to be addedvalue- the value of the attribute to be addedtype- the type of the value of the attribute. SeeAttributeDescr.Type- Returns:
- the container builder
-