public RuleDescrBuilder attribute( String name, String value ) { descr.addAttribute( new AttributeDescr( name, value ) ); return this; }
public RuleDescrBuilder attribute( String name, String value, AttributeDescr.Type type ) { descr.addAttribute( new AttributeDescr( name, value, type ) ); return this; }
public void addRule( final RuleDescr rule ) { if ( this.rules == Collections.EMPTY_LIST ) { this.rules = new ArrayList<RuleDescr>( 1 ); } for ( final AttributeDescr at : attributes ) { // check if rule overrides the attribute if ( !rule.getAttributes().containsKey( at.getName() ) ) { // if not, use default value rule.addAttribute( at ); } } this.rules.add( rule ); }
public AttributeDescrBuilder<RuleDescrBuilder> attribute( String name ) { AttributeDescrBuilder<RuleDescrBuilder> attribute = new AttributeDescrBuilderImpl<RuleDescrBuilder>( this, name ); descr.addAttribute( attribute.getDescr() ); return attribute; }
public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { final Element element = parser.endElementBuilder(); final RuleDescr ruleDescr = (RuleDescr) parser.getCurrent(); final AndDescr lhs = ruleDescr.getLhs(); if ( lhs == null ) { throw new SAXParseException( "<rule> requires a LHS", parser.getLocator() ); } NodeList list = element.getElementsByTagName( "rhs" ); if ( list.getLength() == 0 ) { throw new SAXParseException( "<rule> requires a <rh> child element", parser.getLocator() ); } ruleDescr.setConsequence( ((org.w3c.dom.Text)list.item( 0 ).getChildNodes().item( 0 )).getWholeText() ); NodeList attributes = element.getElementsByTagName( "rule-attribute" ); for ( int i = 0, length = attributes.getLength(); i < length; i++ ) { final String name = ((Element) attributes.item( i )).getAttribute( "name" ); emptyAttributeCheck( "rule-attribute", "name", name, parser ); final String value = ((Element) attributes.item( i )).getAttribute( "value" ); ruleDescr.addAttribute( new AttributeDescr( name, value ) ); } ((PackageDescr) parser.getData()).addRule( ruleDescr ); return ruleDescr; }
DialectCompiletimeRegistry ctr = pkgRegistry.getDialectCompiletimeRegistry(); RuleDescr dummy = new RuleDescr( wd.getName() + " Window Declaration" ); dummy.addAttribute( new AttributeDescr( "dialect", "java" ) ); RuleBuildContext context = new RuleBuildContext( this, dummy,
ruleDescr.addAttribute(new AttributeDescr("dialect", pkgRegistry.getDialect()));