KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > validator > RuleRef


1 package org.sapia.validator;
2
3
4 /**
5  * This class models a reference to a <code>Rule</code> instance. The
6  * reference links to the associated rule through the latter's ID - which
7  * must be specified in such a case.
8  *
9  * @see org.sapia.validator.Rule#getId()
10  *
11  * @author Yanick Duchesne
12  * <dl>
13  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2003 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
14  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
15  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
16  * </dl>
17  */

18 public class RuleRef implements Validatable {
19   private String JavaDoc _ref;
20
21   /**
22    * Constructor for RuleRef.
23    */

24   public RuleRef() {
25     super();
26   }
27
28   /**
29    * Sets the identifier of the rule to which this instance refers.
30    *
31    * @param ref the identifier of the referred <code>Rule</code>.
32    */

33   public void setId(String JavaDoc ref) {
34     _ref = ref;
35   }
36
37   /**
38    * Returns the identifier of the rule to which this instance refers.
39    *
40    * @return the identifier of the referred <code>Rule</code>.
41    */

42   public String JavaDoc getId() {
43     return _ref;
44   }
45
46   /**
47    * @see org.sapia.validator.Validatable#validate(ValidationContext)
48    */

49   public void validate(ValidationContext ctx) {
50     ctx.getConfig().getRule(_ref).validate(ctx);
51   }
52 }
53
Popular Tags