source: other-projects/trunk/realistic-books/packages/AntInstaller/src/org/tp23/antinstaller/input/Validator.java@ 19253

Last change on this file since 19253 was 19253, checked in by davidb, 15 years ago

Establishing a source code repository for Veronica's Realistic Book's software

File size: 1.2 KB
Line 
1package org.tp23.antinstaller.input;
2
3import java.util.Locale;
4
5import org.tp23.antinstaller.InstallerContext;
6
7
8/**
9 * A no args constructor should be provided
10 * @author Paul Hinds
11 * @version $Id: Validator.java,v 1.1.1.1 2005/10/18 18:20:54 teknopaul Exp $
12 */
13public interface Validator {
14
15 /**
16 * Validate the user entry. The InstallerContext is provided to allow
17 * conditional failure based on user input. for example the implementation
18 * of this class could call the following code after failing to open a socket
19 * <pre>
20 * boolean usrOverride = ctx.getMessageRenderer().prompt("Prot not available are you sure?");
21 * if(userOverride)return true;
22 * else{
23 * throw new SocketException();
24 * }
25 * </pre>
26 * @param text may be null it is up to the validator to decide if null or ""
27 * is acceptable
28 * @throws Exception
29 */
30 public void validate(String text,InstallerContext ctx)throws Exception;
31 /**
32 * This method should return a string for every exception that might be
33 * thrown by the validate method. The top level Throwable should be
34 * handled at least.
35 * @param ex
36 * @param l Locale (ignored, but one day we should be internationalized)
37 * @return
38 */
39 public String getErrorMessage(Throwable ex,Locale l);
40}
Note: See TracBrowser for help on using the repository browser.