@Override public LocalTime convert(Date in, Context context) throws Exception { if (in == null) return null; return LocalTime.fromDateFields(in); } }
@Contract("null -> null; !null -> !null") public static @Nullable LocalTime utilDateToJodaTime(final @Nullable Date d) { if (d == null) { return null; } return LocalTime.fromDateFields(d); }
/** * Creates a new LocalTime-valued OData property with {@link EdmSimpleType#TIME} * * @param name the property name * @param value the property value * @return a new OData property instance */ public static OProperty<LocalTime> time(String name, Date value) { return new Impl<LocalTime>(name, EdmSimpleType.TIME, value != null ? LocalTime.fromDateFields(value) : null); }
/** * Creates a new LocalTime-valued OData property with {@link EdmSimpleType#TIME} * * @param name the property name * @param value the property value * @return a new OData property instance */ public static OProperty<LocalTime> time(String name, Date value) { return new Impl<LocalTime>(name, EdmSimpleType.TIME, value != null ? LocalTime.fromDateFields(value) : null); }
/** * Creates a new LocalTime-valued OData property with {@link EdmSimpleType#TIME} * * @param name the property name * @param value the property value * @return a new OData property instance */ public static OProperty<LocalTime> time(String name, Date value) { return new Impl<LocalTime>(name, EdmSimpleType.TIME, value != null ? LocalTime.fromDateFields(value) : null); }
public String getActionTime() { return actionDateTime != null ? FORMATTER.print(LocalTime.fromDateFields(actionDateTime)) : getLocalTimeString(); }
return (T) new LocalTime(obj); else if (Date.class.isAssignableFrom(objClass) && !objClass.equals(java.sql.Date.class)) return (T) LocalTime.fromDateFields((Date) obj); else if (Calendar.class.isAssignableFrom(objClass)) return (T) LocalTime.fromCalendarFields((Calendar) obj);
return (T) new LocalTime(obj); else if (Date.class.isAssignableFrom(objClass) && !objClass.equals(java.sql.Date.class)) return (T) LocalTime.fromDateFields((Date) obj); else if (Calendar.class.isAssignableFrom(objClass)) return (T) LocalTime.fromCalendarFields((Calendar) obj);
return (T) new LocalTime(obj); else if (Date.class.isAssignableFrom(objClass) && !objClass.equals(java.sql.Date.class)) return (T) LocalTime.fromDateFields((Date) obj); else if (Calendar.class.isAssignableFrom(objClass)) return (T) LocalTime.fromCalendarFields((Calendar) obj);
protected List<Shift> createShifts(ShiftDifferentialRule rule, LocalDateTime spanBegin, LocalDateTime spanEnd, DateTimeZone zone) { DateTime spanBeginDT = spanBegin.toDateTime(zone); DateTime spanEndDT = spanEnd.toDateTime(zone); Interval calendarEntryInterval = new Interval(spanBeginDT, spanEndDT); DateTime shiftEnd = LocalTime.fromDateFields(rule.getEndTime()).toDateTime(spanBeginDT).minusDays(1); DateTime shiftStart = LocalTime.fromDateFields(rule.getBeginTime()).toDateTime(spanBeginDT).minusDays(1); if (shiftEnd.isBefore(shiftStart) || shiftEnd.isEqual(shiftStart)) { shiftEnd = shiftEnd.plusDays(1); } List<Shift> shifts = new ArrayList<Shift>(); Interval shiftInterval = new Interval(shiftStart, shiftEnd); //possible that there is no overlap between 1st interval and cal entry interval... if so, add a day. if (!calendarEntryInterval.overlaps(shiftInterval)) { shiftInterval = incrementShift(shiftInterval); } while (calendarEntryInterval.overlaps(shiftInterval)) { if (ruleIsActiveForDay(shiftInterval.getStart(), rule)) { shifts.add(new Shift(rule, shiftInterval, zone)); } shiftInterval = incrementShift(shiftInterval); } return shifts; }