01: /*
02: * Copyright 2004, 2005, 2006 Odysseus Software GmbH
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package de.odysseus.calyxo.forms.convert;
17:
18: import java.text.ParseException;
19: import java.util.Locale;
20:
21: import javax.servlet.http.HttpServletRequest;
22:
23: import de.odysseus.calyxo.forms.Converter;
24:
25: /**
26: * Convenience base class.
27: * Subclasses do not use servlet request.
28: *
29: * @author Christoph Beck
30: * @author Oliver Stuhr
31: */
32: public abstract class SimpleConverter implements Converter {
33:
34: /* (non-Javadoc)
35: * @see de.odysseus.calyxo.forms.Formatter#format(javax.servlet.http.HttpServletRequest, java.lang.Object)
36: */
37: public final String format(HttpServletRequest request, Object value) {
38: return format(value);
39: }
40:
41: /**
42: * Format method
43: * @param value value to be formatted
44: * @return formatted value
45: */
46: public abstract String format(Object value);
47:
48: /* (non-Javadoc)
49: * @see de.odysseus.calyxo.forms.Parser#parse(javax.servlet.http.HttpServletRequest, java.lang.String)
50: */
51:
52: public final Object parse(HttpServletRequest request, String value)
53: throws ParseException {
54: return parse(value);
55: }
56:
57: /**
58: * Parse method
59: * @param value value to be parsed
60: * @return parsed value
61: */
62: public abstract Object parse(String value) throws ParseException;
63:
64: /* (non-Javadoc)
65: * @see de.odysseus.calyxo.forms.impl.ValidationEngine#localize(java.util.Locale)
66: */
67: public void localize(Locale locale) {
68: }
69:
70: /* (non-Javadoc)
71: * @see de.odysseus.calyxo.forms.impl.ValidationEngine#isSharable()
72: */
73: public boolean isSharable() {
74: return false;
75: }
76: }
|