KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > webwork > config_browser > ListValidatorsAction


1 package com.opensymphony.webwork.config_browser;
2
3 import com.opensymphony.xwork.ActionSupport;
4 import com.opensymphony.xwork.validator.ActionValidatorManager;
5
6 import java.util.Collections JavaDoc;
7 import java.util.List JavaDoc;
8
9 /**
10  * ListValidatorsAction loads the validations for a given class and context
11  *
12  * @author Jason Carreira
13  * Date: May 31, 2004 5:06:16 PM
14  */

15 public class ListValidatorsAction extends ActionSupport {
16     private Class JavaDoc clazz;
17     private String JavaDoc context;
18     List JavaDoc validators = Collections.EMPTY_LIST;
19
20     public Class JavaDoc getClazz() {
21         return clazz;
22     }
23
24     public void setClazz(Class JavaDoc clazz) {
25         this.clazz = clazz;
26     }
27
28     public String JavaDoc stripPackage(Class JavaDoc clazz) {
29         return clazz.getName().substring(clazz.getName().lastIndexOf('.') + 1);
30     }
31
32     public String JavaDoc getContext() {
33         return context;
34     }
35
36     public void setContext(String JavaDoc context) {
37         this.context = context;
38     }
39
40     public List JavaDoc getValidators() {
41         return validators;
42     }
43
44     public String JavaDoc execute() throws Exception JavaDoc {
45         loadValidators();
46         return super.execute();
47     }
48
49     protected void loadValidators() {
50         validators = ActionValidatorManager.getValidators(clazz, context);
51     }
52 }
53
Popular Tags