/** * {@inheritDoc} */ @Override public boolean isSupported(final OptionalFeature optionalFeature) { if (optionalFeature == null) { throw new NullPointerException(); } // this switch statement written w/o "default:" to let use know if a new // optional feature is added in the spec switch (optionalFeature) { case STORE_BY_REFERENCE: return true; } throw new IllegalArgumentException("Unknown OptionalFeature: " + optionalFeature.name()); }
@Test public void isSupported() { CachingProvider provider = Caching.getCachingProvider(); OptionalFeature[] features = OptionalFeature.values(); for (OptionalFeature feature : features) { boolean value = provider.isSupported(feature); Logger.getLogger(getClass().getName()).info("Optional feature " + feature + " supported=" + value); } }
/** * {@inheritDoc} */ @Override public boolean isSupported(final OptionalFeature optionalFeature) { if (optionalFeature == null) { throw new NullPointerException(); } // this switch statement written w/o "default:" to let use know if a new // optional feature is added in the spec switch (optionalFeature) { case STORE_BY_REFERENCE: return true; } throw new IllegalArgumentException("Unknown OptionalFeature: " + optionalFeature.name()); }