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 static java.lang.annotation.RetentionPolicy.SOURCE;
20 
21 import androidx.annotation.IntDef;
22 
23 import java.lang.annotation.Retention;
24 
25 /**
26  * Set of conflict handling strategies for various {@link Dao} methods.
27  * <p>
28  * Check <a href="https://sqlite.org/lang_conflict.html">SQLite conflict documentation</a> for
29  * details.
30  */
31 @Retention(SOURCE)
32 @IntDef({OnConflictStrategy.REPLACE, OnConflictStrategy.ROLLBACK, OnConflictStrategy.ABORT,
33         OnConflictStrategy.FAIL, OnConflictStrategy.IGNORE})
34 public @interface OnConflictStrategy {
35     /**
36      * OnConflict strategy constant to replace the old data and continue the transaction.
37      */
38     int REPLACE = 1;
39     /**
40      * OnConflict strategy constant to rollback the transaction.
41      */
42     int ROLLBACK = 2;
43     /**
44      * OnConflict strategy constant to abort the transaction.
45      */
46     int ABORT = 3;
47     /**
48      * OnConflict strategy constant to fail the transaction.
49      */
50     int FAIL = 4;
51     /**
52      * OnConflict strategy constant to ignore the conflict.
53      */
54     int IGNORE = 5;
55 
56 }
57