01: /*
02: * Copyright 2004-2006 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:
17: package org.compass.core.converter;
18:
19: import org.compass.core.config.CompassConfigurable;
20: import org.compass.core.config.CompassSettings;
21:
22: /**
23: * Provides the ability to lookup a converter based on it's type. The type is
24: * the actual <code>Class</code> that should be converted by the returned
25: * <code>Converter</code>.
26: *
27: * @author kimchy
28: * @see Converter
29: */
30: public interface ConverterLookup extends CompassConfigurable {
31:
32: /**
33: * Looks up a converter based on the <code>Class</code> type.
34: *
35: * @param type The class to look the converter for
36: * @return The converter that match for the given class type.
37: */
38: Converter lookupConverter(Class type);
39:
40: /**
41: * Looks up a converter based on the converter name. The converter
42: * should have been registered with the converter lookup using the
43: * {@link #registerConverter(String, Converter)}.
44: *
45: * @param name The lookup name of the converter
46: * @return The converter that match for the given name.
47: */
48: Converter lookupConverter(String name);
49:
50: /**
51: * Registers a {@link Converter} under a converter name.
52: *
53: * @param converterName The converter name to be registered against
54: * @param converter The converter to use
55: */
56: void registerConverter(String converterName, Converter converter);
57:
58: /**
59: * Registers a {@link Converter} under the converter name. Also associates
60: * the converter with the given type.
61: *
62: * @param converterName The converter name to be registered against
63: * @param converter The converter to use
64: * @param registerType The type to associate the converter with
65: */
66: void registerConverter(String converterName, Converter converter,
67: Class registerType);
68:
69: /**
70: * Return the settings that this converter was created with.
71: */
72: CompassSettings getSettings();
73: }
|