Skip to content

Commit

Permalink
[Remove]: [prefixField]
Browse files Browse the repository at this point in the history
  • Loading branch information
old-traveler committed Jan 3, 2020
1 parent 9da92ef commit e5c160e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
8 changes: 1 addition & 7 deletions parrot_lib/src/main/java/com/hyc/parrot_lib/CacheAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.content.SharedPreferences
import android.content.SharedPreferences.Editor
import android.support.v4.app.Fragment
import com.hyc.parrot_lib.Parrot.getActualType
import com.hyc.parrot_lib.Parrot.enableAccessible
import com.hyc.parrot_lib.Parrot.logD
import java.lang.RuntimeException
import java.lang.ref.WeakReference
Expand Down Expand Up @@ -38,18 +37,13 @@ class CacheAdapter(private val dataConvert: DataConvert) {
return sharedPreferences
}

inline fun isCacheParam(field: () -> Field?): InitCache? {
private inline fun isCacheParam(field: () -> Field?): InitCache? {
return field()?.getAnnotation(InitCache::class.java)
}

private fun getRealKey(any: Any, initCache: InitCache, index: Int = 0): String {
val originKey = initCache.value[index]
return when {
initCache.prefixField.isNotEmpty() -> {
val field = any::class.java.getDeclaredField(initCache.prefixField)
field.enableAccessible()
"${field.get(any)}-$originKey"
}
any is PrefixProvider && initCache.prefixKey.isNotEmpty() -> "${any.getKeyPrefix(
originKey,
initCache.prefixKey
Expand Down
1 change: 0 additions & 1 deletion parrot_lib/src/main/java/com/hyc/parrot_lib/InitParam.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ annotation class InitDataStructure(
annotation class InitCache(
vararg val value: String = [],
val spName: String = "",
val prefixField: String = "",
val prefixKey: String = "",
val onlyRead: Boolean = false
)

0 comments on commit e5c160e

Please sign in to comment.