comparison flys-client/src/main/java/org/dive4elements/river/client/shared/FieldVerifier.java @ 5834:f507086aa94b

Repaired internal references.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 12:31:32 +0200
parents flys-client/src/main/java/de/intevation/flys/client/shared/FieldVerifier.java@ba1b27b7d282
children 821a02bbfb4e
comparison
equal deleted inserted replaced
5833:a2bdc0f524e8 5834:f507086aa94b
1 package de.intevation.flys.client.shared;
2
3 /**
4 * <p>
5 * FieldVerifier validates that the name the user enters is valid.
6 * </p>
7 * <p>
8 * This class is in the <code>shared</code> package because we use it in both
9 * the client code and on the server. On the client, we verify that the name is
10 * valid before sending an RPC request so the user doesn't have to wait for a
11 * network round trip to get feedback. On the server, we verify that the name is
12 * correct to ensure that the input is correct regardless of where the RPC
13 * originates.
14 * </p>
15 * <p>
16 * When creating a class that is used on both the client and the server, be sure
17 * that all code is translatable and does not use native JavaScript. Code that
18 * is note translatable (such as code that interacts with a database or the file
19 * system) cannot be compiled into client side JavaScript. Code that uses native
20 * JavaScript (such as Widgets) cannot be run on the server.
21 * </p>
22 */
23 public class FieldVerifier {
24
25 /**
26 * Verifies that the specified name is valid for our service.
27 *
28 * In this example, we only require that the name is at least four
29 * characters. In your application, you can use more complex checks to ensure
30 * that usernames, passwords, email addresses, URLs, and other fields have the
31 * proper syntax.
32 *
33 * @param name the name to validate
34 * @return true if valid, false if invalid
35 */
36 public static boolean isValidName(String name) {
37 if (name == null) {
38 return false;
39 }
40 return name.length() > 3;
41 }
42 }

http://dive4elements.wald.intevation.org