1275e7088223c097c1a2df718455bede42bc9efedYigit Boyar/*
2275e7088223c097c1a2df718455bede42bc9efedYigit Boyar * Copyright (C) 2017 The Android Open Source Project
3275e7088223c097c1a2df718455bede42bc9efedYigit Boyar *
4275e7088223c097c1a2df718455bede42bc9efedYigit Boyar * Licensed under the Apache License, Version 2.0 (the "License");
5275e7088223c097c1a2df718455bede42bc9efedYigit Boyar * you may not use this file except in compliance with the License.
6275e7088223c097c1a2df718455bede42bc9efedYigit Boyar * You may obtain a copy of the License at
7275e7088223c097c1a2df718455bede42bc9efedYigit Boyar *
8275e7088223c097c1a2df718455bede42bc9efedYigit Boyar *      http://www.apache.org/licenses/LICENSE-2.0
9275e7088223c097c1a2df718455bede42bc9efedYigit Boyar *
10275e7088223c097c1a2df718455bede42bc9efedYigit Boyar * Unless required by applicable law or agreed to in writing, software
11275e7088223c097c1a2df718455bede42bc9efedYigit Boyar * distributed under the License is distributed on an "AS IS" BASIS,
12275e7088223c097c1a2df718455bede42bc9efedYigit Boyar * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13275e7088223c097c1a2df718455bede42bc9efedYigit Boyar * See the License for the specific language governing permissions and
14275e7088223c097c1a2df718455bede42bc9efedYigit Boyar * limitations under the License.
15275e7088223c097c1a2df718455bede42bc9efedYigit Boyar */
16275e7088223c097c1a2df718455bede42bc9efedYigit Boyar
17bdc4c86d3dff74f6634a38e2f7b316b0e823a2c8Alan Viverettepackage androidx.room;
18275e7088223c097c1a2df718455bede42bc9efedYigit Boyar
19275e7088223c097c1a2df718455bede42bc9efedYigit Boyarimport java.lang.annotation.ElementType;
20275e7088223c097c1a2df718455bede42bc9efedYigit Boyarimport java.lang.annotation.Retention;
21275e7088223c097c1a2df718455bede42bc9efedYigit Boyarimport java.lang.annotation.RetentionPolicy;
22275e7088223c097c1a2df718455bede42bc9efedYigit Boyarimport java.lang.annotation.Target;
23275e7088223c097c1a2df718455bede42bc9efedYigit Boyar
24275e7088223c097c1a2df718455bede42bc9efedYigit Boyar/**
25275e7088223c097c1a2df718455bede42bc9efedYigit Boyar * Specifies additional type converters that Room can use. The TypeConverter is added to the scope
26275e7088223c097c1a2df718455bede42bc9efedYigit Boyar * of the element so if you put it on a class / interface, all methods / fields in that class will
27275e7088223c097c1a2df718455bede42bc9efedYigit Boyar * be able to use the converters.
28275e7088223c097c1a2df718455bede42bc9efedYigit Boyar * <ul>
29e69e470336d0b6a1b4a16fe1783af17143d0c426Sergey Vasilinets * <li>If you put it on a {@link Database}, all Daos and Entities in that database will be able to
30e69e470336d0b6a1b4a16fe1783af17143d0c426Sergey Vasilinets * use it.
31e69e470336d0b6a1b4a16fe1783af17143d0c426Sergey Vasilinets * <li>If you put it on a {@link Dao}, all methods in the Dao will be able to use it.
32e69e470336d0b6a1b4a16fe1783af17143d0c426Sergey Vasilinets * <li>If you put it on an {@link Entity}, all fields of the Entity will be able to use it.
33e69e470336d0b6a1b4a16fe1783af17143d0c426Sergey Vasilinets * <li>If you put it on a POJO, all fields of the POJO will be able to use it.
34e69e470336d0b6a1b4a16fe1783af17143d0c426Sergey Vasilinets * <li>If you put it on an {@link Entity} field, only that field will be able to use it.
35e69e470336d0b6a1b4a16fe1783af17143d0c426Sergey Vasilinets * <li>If you put it on a {@link Dao} method, all parameters of the method will be able to use it.
36e69e470336d0b6a1b4a16fe1783af17143d0c426Sergey Vasilinets * <li>If you put it on a {@link Dao} method parameter, just that field will be able to use it.
37e69e470336d0b6a1b4a16fe1783af17143d0c426Sergey Vasilinets * </ul>
38275e7088223c097c1a2df718455bede42bc9efedYigit Boyar * @see TypeConverter
39275e7088223c097c1a2df718455bede42bc9efedYigit Boyar */
40275e7088223c097c1a2df718455bede42bc9efedYigit Boyar@Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE, ElementType.FIELD})
41e69e470336d0b6a1b4a16fe1783af17143d0c426Sergey Vasilinets@Retention(RetentionPolicy.CLASS)
42275e7088223c097c1a2df718455bede42bc9efedYigit Boyarpublic @interface TypeConverters {
43275e7088223c097c1a2df718455bede42bc9efedYigit Boyar    /**
44275e7088223c097c1a2df718455bede42bc9efedYigit Boyar     * The list of type converter classes. If converter methods are not static, Room will create
45e69e470336d0b6a1b4a16fe1783af17143d0c426Sergey Vasilinets     * an instance of these classes.
46e69e470336d0b6a1b4a16fe1783af17143d0c426Sergey Vasilinets     *
47275e7088223c097c1a2df718455bede42bc9efedYigit Boyar     * @return The list of classes that contains the converter methods.
48275e7088223c097c1a2df718455bede42bc9efedYigit Boyar     */
49275e7088223c097c1a2df718455bede42bc9efedYigit Boyar    Class<?>[] value();
50275e7088223c097c1a2df718455bede42bc9efedYigit Boyar}
51