Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
AbstractConverter |
|
| 1.0;1 |
1 | /* | |
2 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
3 | * contributor license agreements. See the NOTICE file distributed with | |
4 | * this work for additional information regarding copyright ownership. | |
5 | * The ASF licenses this file to you under the Apache License, Version 2.0 | |
6 | * (the "License"); you may not use this file except in compliance with | |
7 | * the License. You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, software | |
12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | * See the License for the specific language governing permissions and | |
15 | * limitations under the License. | |
16 | */ | |
17 | ||
18 | package org.apache.shale.validator.converter; | |
19 | ||
20 | import javax.faces.component.UIComponent; | |
21 | import javax.faces.context.FacesContext; | |
22 | import javax.faces.convert.Converter; | |
23 | import org.apache.shale.validator.util.AbstractUtilities; | |
24 | ||
25 | /** | |
26 | * <p>Abstract base class for converters that use Apache Commons Validator | |
27 | * as their foundation.</p> | |
28 | */ | |
29 | 30 | public abstract class AbstractConverter extends AbstractUtilities |
30 | implements Converter { | |
31 | ||
32 | ||
33 | // ------------------------------------------------------------ Constructors | |
34 | ||
35 | ||
36 | // ------------------------------------------------------ Manifest Constants | |
37 | ||
38 | ||
39 | // -------------------------------------------------------------- Properties | |
40 | ||
41 | ||
42 | // ------------------------------------------------------- Converter Methods | |
43 | ||
44 | ||
45 | /** | |
46 | * <p>Convert the specified string value, associated with the specified | |
47 | * <code>UIComponent</code>, into a corresponding model data object.</p> | |
48 | * | |
49 | * @param context <code>FacesContext</code> for the current request | |
50 | * @param component <code>UIComponent</code> associated with the | |
51 | * value to be converted | |
52 | * @param value String value to be converted | |
53 | * | |
54 | * @exception ConverterException if conversion cannot be successfully | |
55 | * performed | |
56 | * @exception NullPointerException if <code>context</code> or | |
57 | * <code>component</code> is <code>null</code> | |
58 | */ | |
59 | public abstract Object getAsObject(FacesContext context, UIComponent component, | |
60 | String value); | |
61 | ||
62 | ||
63 | /** | |
64 | * <p>Convert the specified model data object, associated with the | |
65 | * specified <code>UIComponent</code>, into a string suitable for rendering.</p> | |
66 | * | |
67 | * @param context <code>FacesContext</code> for the current request | |
68 | * @param component <code>UIComponent</code> associated with the | |
69 | * model data object to be converted | |
70 | * @param value Model data object to be converted | |
71 | * | |
72 | * @exception ConverterException if conversion cannot be successfully | |
73 | * performed | |
74 | * @exception NullPointerException if <code>context</code> or | |
75 | * <code>component</code> is <code>null</code> | |
76 | */ | |
77 | public abstract String getAsString(FacesContext context, UIComponent component, | |
78 | Object value); | |
79 | ||
80 | ||
81 | // ------------------------------------------------------- Protected Methods | |
82 | ||
83 | ||
84 | } |