Android Open Source - SimpleStorage Date Handler






From Project

Back to project page SimpleStorage.

License

The source code is released under:

Apache License

If you think the Android project SimpleStorage listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.njzk2.simplestorage.handler;
//from ww  w  .  j a v a  2 s.c o  m
import java.util.Date;

import android.database.Cursor;

public class DateHandler extends TypeHandler<Date> {

  @Override
  public Date fromCursor(String name, Cursor content) {
    int column = content.getColumnIndex(name);
    if (content.isNull(column)) {
      return null;
    }
    return new Date(content.getLong(content.getColumnIndex(name)));
  }

  @Override
  public Long getSQLValue(Date object) {
    if (object == null) {
      return null;
    }
    return object.getTime();
  }
}




Java Source Code List

com.njzk2.simplestorage.DataProvider.java
com.njzk2.simplestorage.Database.java
com.njzk2.simplestorage.SQLHelper.java
com.njzk2.simplestorage.SQLSchema.java
com.njzk2.simplestorage.Storable.java
com.njzk2.simplestorage.handler.BooleanHandler.java
com.njzk2.simplestorage.handler.BytesHandler.java
com.njzk2.simplestorage.handler.DateHandler.java
com.njzk2.simplestorage.handler.IntHandler.java
com.njzk2.simplestorage.handler.LongHandler.java
com.njzk2.simplestorage.handler.StringArrayHandler.java
com.njzk2.simplestorage.handler.StringHandler.java
com.njzk2.simplestorage.handler.TypeHandler.java