org.eclipse.persistence.internal.helper.Helper.timeFromLong()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中org.eclipse.persistence.internal.helper.Helper.timeFromLong()方法的一些代码示例,展示了Helper.timeFromLong()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Helper.timeFromLong()方法的具体详情如下:
包路径:org.eclipse.persistence.internal.helper.Helper
类名称:Helper
方法名:timeFromLong

Helper.timeFromLong介绍

[英]Answer a Time from a long
[中]从长计议

代码示例

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

  1. /**
  2. * INTERNAL:
  3. * Build a valid instance of java.sql.Time from the given source object.
  4. * @param sourceObject Valid instance of java.sql.Time, String, java.util.Date, java.sql.Timestamp, or Long
  5. */
  6. protected java.sql.Time convertObjectToTime(Object sourceObject) throws ConversionException {
  7. java.sql.Time time = null;
  8. if (sourceObject instanceof java.sql.Time) {
  9. return (java.sql.Time)sourceObject;//Helper timestamp is not caught on class check.
  10. }
  11. if (sourceObject instanceof String) {
  12. time = Helper.timeFromString((String)sourceObject);
  13. } else if (sourceObject.getClass() == ClassConstants.UTILDATE) {
  14. time = Helper.timeFromDate((java.util.Date)sourceObject);
  15. } else if (sourceObject instanceof java.sql.Timestamp) {
  16. time = Helper.timeFromTimestamp((java.sql.Timestamp)sourceObject);
  17. } else if (sourceObject instanceof Calendar) {
  18. return Helper.timeFromCalendar((Calendar)sourceObject);
  19. } else if (sourceObject instanceof Long) {
  20. time = Helper.timeFromLong((Long)sourceObject);
  21. } else if (sourceObject.getClass() == ClassConstants.TIME_LTIME) {
  22. time = java.sql.Time.valueOf((java.time.LocalTime) sourceObject);
  23. } else if (sourceObject.getClass() == ClassConstants.TIME_OTIME) {
  24. time = java.sql.Time.valueOf(((java.time.OffsetTime) sourceObject).toLocalTime());
  25. } else {
  26. throw ConversionException.couldNotBeConverted(sourceObject, ClassConstants.TIME);
  27. }
  28. return time;
  29. }

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

  1. /**
  2. * INTERNAL:
  3. * Build a valid instance of java.sql.Time from the given source object.
  4. * @param sourceObject Valid instance of java.sql.Time, String, java.util.Date, java.sql.Timestamp, or Long
  5. */
  6. protected java.sql.Time convertObjectToTime(Object sourceObject) throws ConversionException {
  7. java.sql.Time time = null;
  8. if (sourceObject instanceof java.sql.Time) {
  9. return (java.sql.Time)sourceObject;//Helper timestamp is not caught on class check.
  10. }
  11. if (sourceObject instanceof String) {
  12. time = Helper.timeFromString((String)sourceObject);
  13. } else if (sourceObject.getClass() == ClassConstants.UTILDATE) {
  14. time = Helper.timeFromDate((java.util.Date)sourceObject);
  15. } else if (sourceObject instanceof java.sql.Timestamp) {
  16. time = Helper.timeFromTimestamp((java.sql.Timestamp)sourceObject);
  17. } else if (sourceObject instanceof Calendar) {
  18. return Helper.timeFromCalendar((Calendar)sourceObject);
  19. } else if (sourceObject instanceof Long) {
  20. time = Helper.timeFromLong((Long)sourceObject);
  21. } else {
  22. throw ConversionException.couldNotBeConverted(sourceObject, ClassConstants.TIME);
  23. }
  24. return time;
  25. }

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

  1. /**
  2. * INTERNAL:
  3. * Build a valid instance of java.sql.Time from the given source object.
  4. * @param sourceObject Valid instance of java.sql.Time, String, java.util.Date, java.sql.Timestamp, or Long
  5. */
  6. protected java.sql.Time convertObjectToTime(Object sourceObject) throws ConversionException {
  7. java.sql.Time time = null;
  8. if (sourceObject instanceof java.sql.Time) {
  9. return (java.sql.Time)sourceObject;//Helper timestamp is not caught on class check.
  10. }
  11. if (sourceObject instanceof String) {
  12. time = Helper.timeFromString((String)sourceObject);
  13. } else if (sourceObject.getClass() == ClassConstants.UTILDATE) {
  14. time = Helper.timeFromDate((java.util.Date)sourceObject);
  15. } else if (sourceObject instanceof java.sql.Timestamp) {
  16. time = Helper.timeFromTimestamp((java.sql.Timestamp)sourceObject);
  17. } else if (sourceObject instanceof Calendar) {
  18. return Helper.timeFromCalendar((Calendar)sourceObject);
  19. } else if (sourceObject instanceof Long) {
  20. time = Helper.timeFromLong((Long)sourceObject);
  21. } else {
  22. throw ConversionException.couldNotBeConverted(sourceObject, ClassConstants.TIME);
  23. }
  24. return time;
  25. }

相关文章

Helper类方法