View Javadoc

1   /*
2    * AbstractConstraint.java
3    * Created on 27 Июнь 2006 г., 0:44
4    */
5   
6   package org.weda.property.impl;
7   
8   import org.weda.enhance.InjectMessages;
9   import org.weda.message.Messages;
10  import org.weda.property.Constraint;
11  import org.weda.property.ConstraintException;
12  
13  /**
14   * @author Mikhail Titov
15   */
16  public abstract class AbstractConstraint implements Constraint{
17      private String id;
18      @InjectMessages private Messages messages;
19  
20      public String getId() {
21          return id;
22      }
23  
24      public void setId(String id) {
25          this.id = id;
26      }
27      
28      protected void fail() throws ConstraintException {
29          throw new ConstraintException(
30                  messages.getMessage("errorMessage"));
31      }
32      
33      public void init() throws ConstraintException{};
34  }