Class RuleDescrBuilderImpl
- java.lang.Object
-
- org.drools.compiler.lang.api.impl.BaseDescrBuilderImpl<PackageDescrBuilder,RuleDescr>
-
- org.drools.compiler.lang.api.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.compiler.lang.api.impl.BaseDescrBuilderImpl
descr, parent
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRuleDescrBuilderImpl(PackageDescrBuilder parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AttributeDescrBuilder<RuleDescrBuilder>attribute(String name)Adds a new attribute to the statementRuleDescrBuilderattribute(String name, String value)Adds a new attribute with the given name and valueRuleDescrBuilderattribute(String name, String value, AttributeDescr.Type type)Adds a new attribute with the given name and valueRuleDescrBuilderextendsRule(String name)Defines the name of the rule this rule extends.CEDescrBuilder<RuleDescrBuilder,AndDescr>lhs()Defines the LHS (condition) of the rule.RuleDescrBuildername(String name)The name of the rule.RuleDescrBuildernamedRhs(String name, String rhs)An additional named right hand side (consequence) of the rule.AnnotationDescrBuilder<RuleDescrBuilder>newAnnotation(String name)RuleDescrBuilderrhs(String rhs)The default right hand side (consequence) of the rule.-
Methods inherited from class org.drools.compiler.lang.api.impl.BaseDescrBuilderImpl
end, endCharacter, endLocation, getDescr, startCharacter, startLocation
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.drools.compiler.lang.api.DescrBuilder
end, endCharacter, endLocation, getDescr, startCharacter, startLocation
-
-
-
-
Constructor Detail
-
RuleDescrBuilderImpl
protected RuleDescrBuilderImpl(PackageDescrBuilder parent)
-
-
Method Detail
-
newAnnotation
public AnnotationDescrBuilder<RuleDescrBuilder> newAnnotation(String name)
- Specified by:
newAnnotationin interfaceAnnotatedDescrBuilder<RuleDescrBuilder>
-
attribute
public AttributeDescrBuilder<RuleDescrBuilder> attribute(String name)
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
public RuleDescrBuilder name(String 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
public RuleDescrBuilder extendsRule(String name)
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
public RuleDescrBuilder rhs(String 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
public RuleDescrBuilder namedRhs(String name, String rhs)
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
public CEDescrBuilder<RuleDescrBuilder,AndDescr> 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
public RuleDescrBuilder attribute(String name, String value)
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
public RuleDescrBuilder attribute(String name, String value, AttributeDescr.Type type)
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
-
-