01: /**
02: * Copyright 2006 Webmedia Group Ltd.
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: **/package org.araneaframework.uilib.form;
16:
17: import java.io.Serializable;
18: import org.araneaframework.uilib.form.converter.BaseConverter;
19:
20: /**
21: * Form data converter interface, for converting from one data type to another.
22: * See {@link BaseConverter} for description of {@link Converter} purpose in forms.
23: */
24: public interface Converter extends Serializable, FormElementAware {
25:
26: public void setFormElementCtx(FormElementContext feCtx);
27:
28: /**
29: * This method converts the data from one type to another.
30: *
31: * @param data Data to convert.
32: * @return Converted data.
33: */
34: public Object convert(Object data);
35:
36: /**
37: * This method converts the data from one type to another (though the types are exchanged in
38: * comparison with {@link #convert(Object)}).
39: *
40: * @param data Data to convert.
41: * @return Converted data.
42: */
43: public Object reverseConvert(Object data);
44:
45: /**
46: * This method should return a new converter, of the same type that the class that overrides it,
47: * however freshly initialized.
48: *
49: * @return a new converter, of the same type that the class that overrides it, however freshly
50: * initialized.
51: */
52: public Converter newConverter();
53:
54: }
|