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.annotations;
18:
19: import java.lang.annotation.ElementType;
20: import java.lang.annotation.Retention;
21: import java.lang.annotation.RetentionPolicy;
22: import java.lang.annotation.Target;
23:
24: import org.compass.core.converter.Converter;
25:
26: /**
27: * Specifies a class as being "convertable" by Compass.
28: * <p/>
29: * Mostly used to convert classes into a String value that
30: * will be stored in the index. Applies to {@link Searchable} class
31: * {@link SearchableId} and {@link SearchableProperty} annotations.
32: * <p/>
33: * Requires a converter that implements the {@link Converter} interface. Usually
34: * will extend the {@link org.compass.core.converter.basic.AbstractBasicConverter}
35: * (since for other cases, the {@link SearchableComponent} can be used).
36: * <p/>
37: * Alloes for additional settings to be passes to the converter using {@link #settings()}.
38: * For the converter to be injected with the specified settings, it need to implement the
39: * {@link org.compass.core.config.CompassConfigurable} interface.
40: *
41: * @author kimchy
42: */
43: @Target(ElementType.TYPE)
44: @Retention(RetentionPolicy.RUNTIME)
45: public @interface SearchableClassConverter {
46:
47: /**
48: * The converter that will be used to convert the class.
49: * <p/>
50: * Usually will be a converter that converts the class into a String
51: * stored in the search engine index (since for other cases, the {@link SearchableComponent}
52: * can be used). Compass comes with a handy class for such converters:
53: * {@link org.compass.core.converter.basic.AbstractBasicConverter}.
54: */
55: Class<? extends Converter> value();
56:
57: /**
58: * Additional settings to inject to the converter. If set, the converter must implement
59: * the {@link org.compass.core.config.CompassConfigurable} for them to be injected.
60: */
61: SearchSetting[] settings() default {};
62: }
|