weitzj
05/15/2016, 3:22 PMdata class Data(val id: Long, val type: Type, val title: String?, val value: ByteArray) {
enum class Type(val id: Int) {
Invalid(0),
// content
Photo(400),
PhotoThumbnail(410),
// URLs associated with content
URLPhoto(10400),
URLPhotoThumbnail(10410);
companion object {
fun forId(id: Number): Type {
val type = Type.values().find { it.id == id.toInt() }
if (type != null) {
return type
}
return Invalid
}
}
}
}
}