View Javadoc
1   package org.nuiton.validator.bean;
2   /*
3    * #%L
4    * Nuiton Validator
5    * %%
6    * Copyright (C) 2013 - 2014 Code Lutin, Tony Chemit
7    * %%
8    * This program is free software: you can redistribute it and/or modify
9    * it under the terms of the GNU Lesser General Public License as 
10   * published by the Free Software Foundation, either version 3 of the 
11   * License, or (at your option) any later version.
12   * 
13   * This program is distributed in the hope that it will be useful,
14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   * GNU General Lesser Public License for more details.
17   * 
18   * You should have received a copy of the GNU General Lesser Public 
19   * License along with this program.  If not, see
20   * <http://www.gnu.org/licenses/lgpl-3.0.html>.
21   * #L%
22   */
23  
24  import org.nuiton.validator.NuitonValidatorScope;
25  
26  import java.util.EventObject;
27  
28  /**
29   * TODO
30   *
31   * @author Tony Chemit - chemit@codelutin.com
32   * @since 2.5.2
33   */
34  public abstract class AbstractValidatorEvent<V> extends EventObject {
35  
36      private static final long serialVersionUID = 1L;
37  
38      /** the field impacted by the validator */
39      protected String field;
40  
41      /** the scope impacted by the event */
42      protected NuitonValidatorScope scope;
43  
44      protected String[] messagestoAdd;
45  
46      protected String[] messagestoDelete;
47  
48      public abstract Object getBean();
49  
50      public AbstractValidatorEvent(V source,
51                                    String field,
52                                    NuitonValidatorScope scope,
53                                    String[] messagestoAdd,
54                                    String[] messagestoDelete) {
55          super(source);
56          this.field = field;
57          this.scope = scope;
58          this.messagestoAdd = messagestoAdd;
59          this.messagestoDelete = messagestoDelete;
60      }
61  
62      @Override
63      public V getSource() {
64          return (V) super.getSource();
65      }
66  
67      public String[] getMessagesToAdd() {
68          return messagestoAdd;
69      }
70  
71      public String[] getMessagesToDelete() {
72          return messagestoDelete;
73      }
74  
75      public NuitonValidatorScope getScope() {
76          return scope;
77      }
78  
79      public String getField() {
80          return field;
81      }
82  
83  }