KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > wcf > format > RequiredStringHandler


1 /*
2  * ====================================================================
3  * This software is subject to the terms of the Common Public License
4  * Agreement, available at the following URL:
5  * http://www.opensource.org/licenses/cpl.html .
6  * Copyright (C) 2003-2004 TONBELLER AG.
7  * All Rights Reserved.
8  * You must accept the terms of that agreement to use this software.
9  * ====================================================================
10  *
11  *
12  */

13 package com.tonbeller.wcf.format;
14
15 /**
16  * non empty string
17  *
18  * @author av
19  */

20 public class RequiredStringHandler extends StringHandler {
21   public Object JavaDoc parse(String JavaDoc object, String JavaDoc userPattern) {
22     String JavaDoc s = (String JavaDoc) super.parse(object, userPattern);
23     if (s == null || s.trim().length() == 0)
24       throw new FormatException(getErrorMessage(""));
25     return s;
26   }
27 }
28
Popular Tags