final PackageDescr packageDescr = new PackageDescr( "p1" );
RuleDescr ruleDescr = new RuleDescr( "rule-1" );
packageDescr.addRule( ruleDescr );
AndDescr lhs = new AndDescr();
ruleDescr.setLhs( lhs );
PatternDescr patternDescr = new PatternDescr( Cheese.class.getName(),
"stilton" );
FieldConstraintDescr literalDescr = new FieldConstraintDescr( "type" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
null ) );
patternDescr.addConstraint( literalDescr );
ruleDescr.setConsequence( "" );
ruleDescr = new RuleDescr( "rule-1" );
ruleDescr.setLocation( 42,
43 );
packageDescr.addRule( ruleDescr );
lhs = new AndDescr();
ruleDescr.setLhs( lhs );
patternDescr = new PatternDescr( Cheese.class.getName(),
"stilton" );
literalDescr = new FieldConstraintDescr( "type" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "!=",
null ) );
patternDescr.addConstraint( literalDescr );
ruleDescr.setConsequence( "" );
ruleDescr = new RuleDescr( "rule-2" );
ruleDescr.setLocation( 42,
43 );
packageDescr.addRule( ruleDescr );
lhs = new AndDescr();
ruleDescr.setLhs( lhs );
patternDescr = new PatternDescr( Cheese.class.getName(),
"stilton" );
literalDescr = new FieldConstraintDescr( "type" );