|
1 | | -/** Provides classes related to `android.content.SharedPreferences`. */ |
2 | | - |
3 | 1 | import java |
4 | 2 |
|
5 | | -/** Definitions related to `android.content.SharedPreferences`. */ |
6 | | -module SharedPreferences { |
7 | | - /** The interface `android.content.SharedPreferences` */ |
8 | | - class TypeBase extends Interface { |
9 | | - TypeBase() { hasQualifiedName("android.content", "SharedPreferences") } |
10 | | - } |
11 | | - |
12 | | - /** The class `androidx.security.crypto.EncryptedSharedPreferences`, which implements `SharedPreferences` with encryption support. */ |
13 | | - class TypeEncrypted extends Class { |
14 | | - TypeEncrypted() { hasQualifiedName("androidx.security.crypto", "EncryptedSharedPreferences") } |
15 | | - } |
| 3 | +/** The interface `android.content.SharedPreferences`. */ |
| 4 | +class SharedPreferences extends Interface { |
| 5 | + SharedPreferences() { this.hasQualifiedName("android.content", "SharedPreferences") } |
| 6 | +} |
16 | 7 |
|
17 | | - /** The create method of `androidx.security.crypto.EncryptedSharedPreferences` */ |
18 | | - class CreateEncryptedMethod extends Method { |
19 | | - CreateEncryptedMethod() { |
20 | | - getDeclaringType() instanceof TypeEncrypted and |
21 | | - hasName("create") |
22 | | - } |
| 8 | +/** The class `androidx.security.crypto.EncryptedSharedPreferences`, which implements `SharedPreferences` with encryption support. */ |
| 9 | +class EncryptedSharedPreferences extends Class { |
| 10 | + EncryptedSharedPreferences() { |
| 11 | + this.hasQualifiedName("androidx.security.crypto", "EncryptedSharedPreferences") |
23 | 12 | } |
| 13 | +} |
24 | 14 |
|
25 | | - /** A getter method of `android.content.SharedPreferences`. */ |
26 | | - class GetPreferenceMethod extends Method { |
27 | | - GetPreferenceMethod() { |
28 | | - getDeclaringType() instanceof TypeBase and |
29 | | - getName().matches("get%") |
30 | | - } |
| 15 | +/** The `create` method of `androidx.security.crypto.EncryptedSharedPreferences`. */ |
| 16 | +class CreateEncryptedSharedPreferencesMethod extends Method { |
| 17 | + CreateEncryptedSharedPreferencesMethod() { |
| 18 | + this.getDeclaringType() instanceof EncryptedSharedPreferences and |
| 19 | + this.hasName("create") |
31 | 20 | } |
| 21 | +} |
32 | 22 |
|
33 | | - /** Returns `android.content.SharedPreferences.Editor` from the `edit` call of `android.content.SharedPreferences`. */ |
34 | | - class GetEditorMethod extends Method { |
35 | | - GetEditorMethod() { |
36 | | - getDeclaringType() instanceof TypeBase and |
37 | | - hasName("edit") and |
38 | | - getReturnType() instanceof TypeEditor |
39 | | - } |
| 23 | +/** Returns `android.content.SharedPreferences.Editor` from the `edit` call of `android.content.SharedPreferences`. */ |
| 24 | +class GetSharedPreferencesEditorMethod extends Method { |
| 25 | + GetSharedPreferencesEditorMethod() { |
| 26 | + this.getDeclaringType() instanceof SharedPreferences and |
| 27 | + this.hasName("edit") and |
| 28 | + this.getReturnType() instanceof SharedPreferencesEditor |
40 | 29 | } |
| 30 | +} |
41 | 31 |
|
42 | | - /** Definitions related to `android.content.SharedPreferences.Editor`. */ |
43 | | - class TypeEditor extends Interface { |
44 | | - TypeEditor() { hasQualifiedName("android.content", "SharedPreferences$Editor") } |
45 | | - } |
| 32 | +/** The interface `android.content.SharedPreferences.Editor`. */ |
| 33 | +class SharedPreferencesEditor extends Interface { |
| 34 | + SharedPreferencesEditor() { this.hasQualifiedName("android.content", "SharedPreferences$Editor") } |
| 35 | +} |
46 | 36 |
|
47 | | - /** A setter method for `android.content.SharedPreferences`. */ |
48 | | - class SetPreferenceMethod extends Method { |
49 | | - SetPreferenceMethod() { |
50 | | - getDeclaringType() instanceof TypeEditor and |
51 | | - getName().matches("put%") |
52 | | - } |
| 37 | +/** A method that updates a key-value pair in a `android.content.SharedPreferences` through a `SharedPreferences.Editor`. The value is not written until a `StorePreferenceMethod` is called. */ |
| 38 | +class PutSharedPreferenceMethod extends Method { |
| 39 | + PutSharedPreferenceMethod() { |
| 40 | + this.getDeclaringType() instanceof SharedPreferencesEditor and |
| 41 | + this.getName().matches("put%") |
53 | 42 | } |
| 43 | +} |
54 | 44 |
|
55 | | - /** A setter method for `android.content.SharedPreferences`. */ |
56 | | - class StorePreferenceMethod extends Method { |
57 | | - StorePreferenceMethod() { |
58 | | - getDeclaringType() instanceof TypeEditor and |
59 | | - hasName(["commit", "apply"]) |
60 | | - } |
| 45 | +/** A method on `SharedPreferences.Editor` that writes the pending changes to the underlying `android.content.SharedPreferences`. */ |
| 46 | +class StoreSharedPreferenceMethod extends Method { |
| 47 | + StoreSharedPreferenceMethod() { |
| 48 | + this.getDeclaringType() instanceof SharedPreferencesEditor and |
| 49 | + this.hasName(["commit", "apply"]) |
61 | 50 | } |
62 | 51 | } |
0 commit comments