SimpleFrequencyFactory extends AbstractNamedInstanceFactory<SimpleFrequency> { @Deprecated public Iterator<SimpleFrequency> enumerateAvailableFrequencies() { List<SimpleFrequency> frequencies = new ArrayList<>(instanceMap().values()); Collections.sort(frequencies, new Comparator<SimpleFrequency>() { @Override public int compare(final SimpleFrequency o1, final SimpleFrequency o2) { return (int) Math.signum(o2.getPeriodsPerYear() - o1.getPeriodsPerYear()); } }); return frequencies.iterator(); } private  SimpleFrequencyFactory(); @FromString static SimpleFrequency of(final String name); @Deprecated SimpleFrequency getFrequency(final String name); SimpleFrequency getFrequency(final int periods); @Deprecated Iterator<SimpleFrequency> enumerateAvailableFrequencies(); static final SimpleFrequencyFactory INSTANCE; }
@Test @SuppressWarnings("deprecation") public void enumerateAvailableFrequencies() { List<SimpleFrequency> frequencies = Lists.newArrayList(_factory.enumerateAvailableFrequencies()); assertEquals(frequencies, Lists.newArrayList( SimpleFrequency.CONTINUOUS, SimpleFrequency.DAILY, SimpleFrequency.WEEKLY, SimpleFrequency.BIWEEKLY, SimpleFrequency.THREE_WEEKS, SimpleFrequency.TWENTY_EIGHT_DAYS, SimpleFrequency.MONTHLY, SimpleFrequency.BIMONTHLY, SimpleFrequency.QUARTERLY, SimpleFrequency.FOUR_MONTHS, SimpleFrequency.FIVE_MONTHS, SimpleFrequency.SEMI_ANNUAL, SimpleFrequency.SEVEN_MONTHS, SimpleFrequency.EIGHT_MONTHS, SimpleFrequency.NINE_MONTHS, SimpleFrequency.TEN_MONTHS, SimpleFrequency.ELEVEN_MONTHS, SimpleFrequency.ANNUAL, SimpleFrequency.NEVER)); }