-
-
Notifications
You must be signed in to change notification settings - Fork 714
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* update changelog * Disable property type cast to fix issue gh-291 * Rename KoinExt.kt to KoinPropertyExt.kt Co-authored-by: Arnaud Giuliani <giuliani.arnaud@gmail.com>
- Loading branch information
1 parent
d9424f4
commit 39f1c3e
Showing
16 changed files
with
103 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
koin-projects/koin-core/src/main/kotlin/org/koin/ext/KoinPropertyExt.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package org.koin.ext | ||
|
||
import org.koin.core.Koin | ||
|
||
/** | ||
* Koin extension functions | ||
* | ||
* Non-essential helper functions | ||
* | ||
* @author Edward Zhou | ||
*/ | ||
|
||
/** | ||
* Retrieve an int property | ||
* @param key | ||
* @param defaultValue | ||
*/ | ||
fun Koin.getIntProperty(key: String, defaultValue: Int): Int { | ||
return getIntProperty(key) ?: defaultValue | ||
} | ||
|
||
/** | ||
* Retrieve an int property | ||
* @param key | ||
*/ | ||
fun Koin.getIntProperty(key: String): Int? { | ||
return getProperty(key)?.toIntOrNull() | ||
} | ||
|
||
/** | ||
* Save an int property | ||
* @param key | ||
* @param value | ||
*/ | ||
fun Koin.setIntProperty(key: String, value: Int) { | ||
setProperty(key, value.toString()) | ||
} | ||
|
||
/** | ||
* Retrieve a float property | ||
* @param key | ||
* @param defaultValue | ||
*/ | ||
fun Koin.getFloatProperty(key: String, defaultValue: Float): Float { | ||
return getFloatProperty(key) ?: defaultValue | ||
} | ||
|
||
/** | ||
* Retrieve a float property | ||
* @param key | ||
*/ | ||
fun Koin.getFloatProperty(key: String): Float? { | ||
return getProperty(key)?.toFloatOrNull() | ||
} | ||
|
||
/** | ||
* Save a float property | ||
* @param key | ||
* @param value | ||
*/ | ||
fun Koin.setFloatProperty(key: String, value: Float) { | ||
setProperty(key, value.toString()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters