Skip to content

Instantly share code, notes, and snippets.

View milechainsaw's full-sized avatar

Milenko Jovanovic milechainsaw

  • Spatially distributed
View GitHub Profile
@milechainsaw
milechainsaw / Model.kt
Last active May 19, 2020 16:44
ObjectBox converter for List<String> properties in your Kotlin data model. http://objectbox.io/
package com.test.objectbox.models
import io.objectbox.annotation.Convert
import io.objectbox.annotation.Entity
import io.objectbox.annotation.Id
@Entity data class Article(
@Id var id: Long = 0,
@Convert(converter = StringListConverter::class, dbType = String::class)
var strings: List<String>? = null,
package com.test.objectbox.converters
import io.objectbox.converter.PropertyConverter
/**
* Created by milenkojovanovic on 9/14/17.
*/
class StringListConverter : PropertyConverter<List<String>, String> {
override fun convertToEntityProperty(databaseValue: String?): List<String> {
@milechainsaw
milechainsaw / BackoffCallback.java
Created July 19, 2016 12:53
Exponential backoff support for Retrofit2.
/**
* Created by milechainsaw on 7/19/16.
*
* Exponential backoff callback for Retrofit2
*
*/
public abstract class BackoffCallback<T> implements Callback<T> {
private static final int RETRY_COUNT = 3;
/**
* Base retry delay for exponential backoff, in Milliseconds