代码@TypeConverterAnnotation是什么意思?
下面的代码是从一个网页,我不明白的代码@TypeConverterAnnotation是什么意思?
这只是一个注释,我可以删除代码吗?
package mobi.porquenao.poc.kotlin.core import com.raizlabs.android.dbflow.converter.TypeConverter import java.util.* import com.raizlabs.android.dbflow.annotation.TypeConverter as TypeConverterAnnotation @TypeConverterAnnotation class CalendarConverter : TypeConverter<Long, Calendar>() { override fun getDBValue(model: Calendar): Long? { return model.timeInMillis } override fun getModelValue(data: Long?): Calendar { val calendar = Calendar.getInstance() calendar.timeInMillis = data!! return calendar } }
是的,这只是 DBFlow项目的一个注释:
/** * Author: andrewgrosner * Description: Marks a class as being a TypeConverter. * A type converter will turn a non-model, non-SQLiteTyped class into * a valid database type. */ @Retention(RetentionPolicy.CLASS) @Target(ElementType.TYPE) public @interface TypeConverter { /** * @return Specify a set of subclasses by which the {@link TypeConverter} * registers for. For each one, this will create a new instance of the converter. */ Class<?>[] allowedSubtypes() default {}; }
我们如何知道你的代码是否需要它? 🙂
- 错误“不能为null”在Kotlin中
- 如何将Gson类型适配器转换为Klaxon类型适配器
- 为什么kotlin不能在安装kotlin插件的andriod studio中工作
- 使用IntelliJ的Gluon / JavaFXPorts的Android应用程序 – Android设置不完整
- 如何在kotlin的customadpter项目上实现clicklistener?
- Kotlin kotlinClass.class.getName()不能返回包名,而只能返回简单的类名
- 在anko DSL中相当于<fragment>标签
- Kotlin库'classes.jar'具有不受支持的格式。 请更新库或插件
- hasSystemFeature方法在检查BluetoothLE支持时返回错误的值