Last active
January 12, 2016 01:11
-
-
Save desamtralized/1251b7a1a366a80ed246 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 com.sambarboza | |
import com.parse.ParseObject | |
import kotlin.reflect.KProperty | |
public class ParseDelegate<T> { | |
@Suppress("UNCHECKED_CAST") | |
operator fun getValue(parseObj: ParseObject, propertyMetadata: KProperty<*>): T { | |
return parseObj.get(propertyMetadata.name) as T | |
} | |
operator fun setValue(parseObj: ParseObject, propertyMetadata: KProperty<*>, a: Any?) { | |
if (a != null) { | |
parseObj.put(propertyMetadata.name, a) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment