01: /*
02: * Copyright 2004-2007 the original author or authors.
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 org.springframework.binding.convert.support;
17:
18: import org.springframework.binding.format.FormatterFactory;
19:
20: /**
21: * A converter that delegates to a formatter to perform the conversion.
22: * Formatters are typically not thread safe, so we use a FormatterFactory that
23: * is expected to provide us with thread-safe instances as necessary.
24: *
25: * @author Keith Donald
26: */
27: public abstract class AbstractFormattingConverter extends
28: AbstractConverter {
29:
30: /**
31: * The formatter factory.
32: */
33: private FormatterFactory formatterFactory;
34:
35: /**
36: * Creates a new converter that delegates to a formatter.
37: * @param formatterFactory the factory to use
38: */
39: protected AbstractFormattingConverter(
40: FormatterFactory formatterFactory) {
41: setFormatterFactory(formatterFactory);
42: }
43:
44: protected FormatterFactory getFormatterFactory() {
45: return formatterFactory;
46: }
47:
48: public void setFormatterFactory(FormatterFactory formatterSource) {
49: this.formatterFactory = formatterSource;
50: }
51: }
|