Created
June 7, 2017 06:34
-
-
Save elsennov/e5a06feb4b62a7d4f0da3d7a7e4593f3 to your computer and use it in GitHub Desktop.
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
package io.prismapp.mobile.chat.base.dbflow.typeconverter | |
import com.raizlabs.android.dbflow.converter.TypeConverter | |
import io.prismapp.mobile.base.PrismApplication | |
import io.prismapp.mobile.chat.base.model.BrokerMetadata | |
/** | |
* Created by elsennovraditya on 8/24/16. | |
*/ | |
class BrokerMetadataConverter : TypeConverter<String, BrokerMetadata>() { | |
override fun getDBValue(model: BrokerMetadata?): String? { | |
return if (model == null) null else PrismApplication.prismComponent.provideGson().toJson(model) | |
} | |
override fun getModelValue(data: String): BrokerMetadata { | |
return PrismApplication.prismComponent.provideGson().fromJson(data, BrokerMetadata::class.java) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment