Google은 흑인 공동체를 위한 인종 간 평등을 진전시키기 위해 노력하고 있습니다. Google에서 어떤 노력을 하고 있는지 확인하세요.

TypeConverter

public abstract @interface TypeConverter
implements Annotation

android.arch.persistence.room.TypeConverter


Marks a method as a type converter. A class can have as many @TypeConverter methods as it needs.

Each converter method should receive 1 parameter and have non-void return type.

 // example converter for java.util.Date
 public static class Converters {
    @TypeConverter
    public Date fromTimestamp(Long value) {
        return value == null ? null : new Date(value);
    }

    @TypeConverter
    public Long dateToTimestamp(Date date) {
        if (date == null) {
            return null;
        } else {
            return date.getTime();
        }
    }
}
 

See also:

Summary

Inherited methods