1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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 androidx.room;
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 /**
25  * Specifies additional type converters that Room can use. The TypeConverter is added to the scope
26  * of the element so if you put it on a class / interface, all methods / fields in that class will
27  * be able to use the converters.
28  * <ul>
29  * <li>If you put it on a {@link Database}, all Daos and Entities in that database will be able to
30  * use it.
31  * <li>If you put it on a {@link Dao}, all methods in the Dao will be able to use it.
32  * <li>If you put it on an {@link Entity}, all fields of the Entity will be able to use it.
33  * <li>If you put it on a POJO, all fields of the POJO will be able to use it.
34  * <li>If you put it on an {@link Entity} field, only that field will be able to use it.
35  * <li>If you put it on a {@link Dao} method, all parameters of the method will be able to use it.
36  * <li>If you put it on a {@link Dao} method parameter, just that field will be able to use it.
37  * </ul>
38  * @see TypeConverter
39  */
40 @Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE, ElementType.FIELD})
41 @Retention(RetentionPolicy.CLASS)
42 public @interface TypeConverters {
43     /**
44      * The list of type converter classes. If converter methods are not static, Room will create
45      * an instance of these classes.
46      *
47      * @return The list of classes that contains the converter methods.
48      */
value()49     Class<?>[] value();
50 }
51