org.drools.lang.api.impl
Class RuleDescrBuilderImpl

java.lang.Object
  extended by org.drools.lang.api.impl.BaseDescrBuilderImpl<PackageDescrBuilder,RuleDescr>
      extended by org.drools.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.lang.api.impl.BaseDescrBuilderImpl
descr, parent
 
Constructor Summary
protected RuleDescrBuilderImpl(PackageDescrBuilder parent)
           
 
Method Summary
 AttributeDescrBuilder<RuleDescrBuilder> attribute(String name)
          Adds a new attribute to the statement
 RuleDescrBuilder attribute(String name, String value)
          Adds a new attribute with the given name and value
 RuleDescrBuilder attribute(String name, String value, AttributeDescr.Type type)
          Adds a new attribute with the given name and value
 RuleDescrBuilder extendsRule(String name)
          Defines the name of the rule this rule extends.
 CEDescrBuilder<RuleDescrBuilder,AndDescr> lhs()
          Defines the LHS (condition) of the rule.
 RuleDescrBuilder name(String name)
          The name of the rule.
 AnnotationDescrBuilder<RuleDescrBuilder> newAnnotation(String name)
           
 RuleDescrBuilder rhs(String rhs)
          The right hand side (consequence) of the rule.
 
Methods inherited from class org.drools.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.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:
newAnnotation in interface AnnotatedDescrBuilder<RuleDescrBuilder>

attribute

public AttributeDescrBuilder<RuleDescrBuilder> attribute(String name)
Description copied from interface: AttributeSupportBuilder
Adds a new attribute to the statement

Specified by:
attribute in interface AttributeSupportBuilder<RuleDescrBuilder>
Parameters:
name - the attribute name
Returns:
the AttributeDescrBuilder to set the attribute value

name

public RuleDescrBuilder name(String name)
Description copied from interface: RuleDescrBuilder
The name of the rule. Best practice is to keep rule names relatively short, i.e. under 60 characters.

Specified by:
name in interface RuleDescrBuilder
Parameters:
name - name of the rule
Returns:
itself

extendsRule

public RuleDescrBuilder extendsRule(String name)
Description copied from interface: RuleDescrBuilder
Defines the name of the rule this rule extends. It will cause the rule to inherit the LHS from the parent rule.

Specified by:
extendsRule in interface RuleDescrBuilder
Parameters:
name - name of the parent rule
Returns:
itself

rhs

public RuleDescrBuilder rhs(String rhs)
Description copied from interface: RuleDescrBuilder
The 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:
rhs in interface RuleDescrBuilder
Parameters:
rhs - the code block
Returns:
itself

lhs

public CEDescrBuilder<RuleDescrBuilder,AndDescr> lhs()
Description copied from interface: RuleDescrBuilder
Defines the LHS (condition) of the rule.

Specified by:
lhs in interface RuleDescrBuilder
Returns:
a Conditional Element descriptor builder with the AND CE semantic.

attribute

public RuleDescrBuilder attribute(String name,
                                  String value)
Description copied from interface: AttributeSupportBuilder
Adds a new attribute with the given name and value

Specified by:
attribute in interface AttributeSupportBuilder<RuleDescrBuilder>
Parameters:
name - the name of the attribute to be added
value - 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: AttributeSupportBuilder
Adds a new attribute with the given name and value

Specified by:
attribute in interface AttributeSupportBuilder<RuleDescrBuilder>
Parameters:
name - the name of the attribute to be added
value - the value of the attribute to be added
type - the type of the value of the attribute. See AttributeDescr.Type
Returns:
the container builder


Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.