2017-08-04 28 views
1

次のコードはウェブページからのものですが、@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 
    } 

} 

答えて

4

はい、それはDBFlow projectからだけ注釈です:あなたは、あなたのコード内でか、それを必要とする場合

/** 
* 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 {}; 
} 

はどのようにして知ることができますか? :)

関連する問題