/** * {@inheritDoc} */ @Override public CharSequence format(final DayOfWeek dayOfWeek) { return weekDayLabels[dayOfWeek.getValue() - 1]; } }
firstDayOfWeek = DayOfWeek.of(firstDayOfWeekInt); } else { firstDayOfWeek = WeekFields.of(Locale.getDefault()).getFirstDayOfWeek();
/** * {@inheritDoc} */ @Override public CharSequence format(final DayOfWeek dayOfWeek) { return dayOfWeek.getDisplayName(TextStyle.SHORT, Locale.getDefault()); } }
if (dow != null) { if (dom == -1) { buf.append(dow.name()).append(" on or before last day of ").append(month.name()); } else if (dom < 0) { buf.append(dow.name()).append(" on or before last day minus ").append(-dom - 1).append(" of ").append(month.name()); } else { buf.append(dow.name()).append(" on or after ").append(month.name()).append(' ').append(dom);
@Override public DayOfWeek queryFrom(TemporalAccessor temporal) { return DayOfWeek.from(temporal); } };
/** * Returns the day-of-week that is the specified number of days before this one. * <p> * The calculation rolls around the start of the year from Monday to Sunday. * The specified period may be negative. * <p> * This instance is immutable and unaffected by this method call. * * @param days the days to subtract, positive or negative * @return the resulting day-of-week, not null */ public DayOfWeek minus(long days) { return plus(-(days % 7)); }
if (dow != null) { if (dom == -1) { buf.append(dow.name()).append(" on or before last day of ").append(month.name()); } else if (dom < 0) { buf.append(dow.name()).append(" on or before last day minus ").append(-dom - 1).append(" of ").append(month.name()); } else { buf.append(dow.name()).append(" on or after ").append(month.name()).append(' ').append(dom);
@Override public DayOfWeek queryFrom(TemporalAccessor temporal) { return DayOfWeek.from(temporal); } };
protected LocalDate resetAndGetWorkingCalendar() { final TemporalField firstDayOfWeek = WeekFields.of(this.firstDayOfWeek, 1).dayOfWeek(); final LocalDate temp = getFirstViewDay().getDate().with(firstDayOfWeek, 1); int dow = temp.getDayOfWeek().getValue(); int delta = getFirstDayOfWeek().getValue() - dow; //If the delta is positive, we want to remove a week boolean removeRow = showOtherMonths(showOtherDates) ? delta >= 0 : delta > 0; if (removeRow) { delta -= DEFAULT_DAYS_IN_WEEK; } return temp.plusDays(delta); }
/** * Obtains an instance of {@code DayOfWeek} from a temporal object. * <p> * A {@code TemporalAccessor} represents some form of date and time information. * This factory converts the arbitrary temporal object to an instance of {@code DayOfWeek}. * <p> * The conversion extracts the {@link ChronoField#DAY_OF_WEEK DAY_OF_WEEK} field. * <p> * This method matches the signature of the functional interface {@link TemporalQuery} * allowing it to be used as a query via method reference, {@code DayOfWeek::from}. * * @param temporal the temporal object to convert, not null * @return the day-of-week, not null * @throws DateTimeException if unable to convert to a {@code DayOfWeek} */ public static DayOfWeek from(TemporalAccessor temporal) { if (temporal instanceof DayOfWeek) { return (DayOfWeek) temporal; } try { return of(temporal.get(DAY_OF_WEEK)); } catch (DateTimeException ex) { throw new DateTimeException("Unable to obtain DayOfWeek from TemporalAccessor: " + temporal + ", type " + temporal.getClass().getName(), ex); } }
/** * Returns the day-of-week that is the specified number of days before this one. * <p> * The calculation rolls around the start of the year from Monday to Sunday. * The specified period may be negative. * <p> * This instance is immutable and unaffected by this method call. * * @param days the days to subtract, positive or negative * @return the resulting day-of-week, not null */ public DayOfWeek minus(long days) { return plus(-(days % 7)); }
String rruleText = String.format(rruleTemplate,transitionRuleMonthValue, weekdayIndexInMonth, transitionRuleDayOfWeek.name().substring(0, 2));
private DayOfWeekInMonth(int ordinal, DayOfWeek dow) { super(); this.ordinal = ordinal; this.dowValue = dow.getValue(); } @Override
/** * Obtains an instance of {@code DayOfWeek} from a temporal object. * <p> * A {@code TemporalAccessor} represents some form of date and time information. * This factory converts the arbitrary temporal object to an instance of {@code DayOfWeek}. * <p> * The conversion extracts the {@link ChronoField#DAY_OF_WEEK DAY_OF_WEEK} field. * <p> * This method matches the signature of the functional interface {@link TemporalQuery} * allowing it to be used as a query via method reference, {@code DayOfWeek::from}. * * @param temporal the temporal object to convert, not null * @return the day-of-week, not null * @throws DateTimeException if unable to convert to a {@code DayOfWeek} */ public static DayOfWeek from(TemporalAccessor temporal) { if (temporal instanceof DayOfWeek) { return (DayOfWeek) temporal; } try { return of(temporal.get(DAY_OF_WEEK)); } catch (DateTimeException ex) { throw new DateTimeException("Unable to obtain DayOfWeek from TemporalAccessor: " + temporal + ", type " + temporal.getClass().getName(), ex); } }