本文整理了Java中org.eclipse.persistence.internal.helper.Helper.dateFromTimestamp()
方法的一些代码示例,展示了Helper.dateFromTimestamp()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Helper.dateFromTimestamp()
方法的具体详情如下:
包路径:org.eclipse.persistence.internal.helper.Helper
类名称:Helper
方法名:dateFromTimestamp
[英]Answer a Date from a timestamp This implementation is based on the java.sql.Date class, not java.util.Date.
[中]根据时间戳回答日期此实现基于java。sql。日期类,而不是java。util。日期
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* Convert the object to an instance of java.sql.Date.
* @param sourceObject Object of type java.sql.Timestamp, java.util.Date, String or Long
*/
protected java.sql.Date convertObjectToDate(Object sourceObject) throws ConversionException {
java.sql.Date date = null;
if (sourceObject instanceof java.sql.Date) {
date = (java.sql.Date)sourceObject;//Helper date is not caught on class check.
} else if (sourceObject instanceof java.sql.Timestamp) {
date = Helper.dateFromTimestamp((java.sql.Timestamp)sourceObject);
} else if (sourceObject.getClass() == ClassConstants.UTILDATE) {
date = Helper.sqlDateFromUtilDate((java.util.Date)sourceObject);
} else if (sourceObject instanceof Calendar) {
return Helper.dateFromCalendar((Calendar)sourceObject);
} else if (sourceObject instanceof String) {
date = Helper.dateFromString((String)sourceObject);
} else if (sourceObject instanceof Long) {
date = Helper.dateFromLong((Long)sourceObject);
} else {
throw ConversionException.couldNotBeConverted(sourceObject, ClassConstants.SQLDATE);
}
return date;
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* Convert the object to an instance of java.sql.Date.
* @param sourceObject Object of type java.sql.Timestamp, java.util.Date, String or Long
*/
protected java.sql.Date convertObjectToDate(Object sourceObject) throws ConversionException {
java.sql.Date date = null;
if (sourceObject instanceof java.sql.Date) {
date = (java.sql.Date)sourceObject;//Helper date is not caught on class check.
} else if (sourceObject instanceof java.sql.Timestamp) {
date = Helper.dateFromTimestamp((java.sql.Timestamp)sourceObject);
} else if (sourceObject.getClass() == ClassConstants.UTILDATE) {
date = Helper.sqlDateFromUtilDate((java.util.Date)sourceObject);
} else if (sourceObject instanceof Calendar) {
return Helper.dateFromCalendar((Calendar)sourceObject);
} else if (sourceObject instanceof String) {
date = Helper.dateFromString((String)sourceObject);
} else if (sourceObject instanceof Long) {
date = Helper.dateFromLong((Long)sourceObject);
} else {
throw ConversionException.couldNotBeConverted(sourceObject, ClassConstants.SQLDATE);
}
return date;
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
/**
* Convert the object to an instance of java.sql.Date.
* @param sourceObject Object of type java.sql.Timestamp, java.util.Date, String or Long
*/
protected java.sql.Date convertObjectToDate(Object sourceObject) throws ConversionException {
java.sql.Date date = null;
if (sourceObject instanceof java.sql.Date) {
date = (java.sql.Date)sourceObject;//Helper date is not caught on class check.
} else if (sourceObject instanceof java.sql.Timestamp) {
date = Helper.dateFromTimestamp((java.sql.Timestamp)sourceObject);
} else if (sourceObject.getClass() == ClassConstants.UTILDATE) {
date = Helper.sqlDateFromUtilDate((java.util.Date)sourceObject);
} else if (sourceObject instanceof Calendar) {
return Helper.dateFromCalendar((Calendar)sourceObject);
} else if (sourceObject instanceof String) {
date = Helper.dateFromString((String)sourceObject);
} else if (sourceObject instanceof Long) {
date = Helper.dateFromLong((Long)sourceObject);
} else {
throw ConversionException.couldNotBeConverted(sourceObject, ClassConstants.SQLDATE);
}
return date;
}
内容来源于网络,如有侵权,请联系作者删除!