@Test public void testGet() throws Exception { assertThat(provider.get(Arguments.of("small"), ImmutableList.<Annotation>of()), is(Size.SMALL)); assertThat( provider.get(Arguments.of("verylarge"), ImmutableList.<Annotation>of()), is(Size.VERY_LARGE)); assertThat( provider.get(Arguments.of("very_large"), ImmutableList.<Annotation>of()), is(Size.VERY_LARGE)); }
@Nullable @Override public T get(CommandArgs arguments, List<? extends Annotation> modifiers) throws ArgumentException, ProvisionException { String name = arguments.next(); String test = simplify(name); for (T entry : enumClass.getEnumConstants()) { if (simplify(entry.name()).equalsIgnoreCase(test)) { return entry; } } throw new ArgumentParseException( "No matching value found in the '" + enumClass.getSimpleName() + "' list."); }
EnumProvider implements Provider<T> { @Nullable @Override public T get(CommandArgs arguments, List<? extends Annotation> modifiers) throws ArgumentException, ProvisionException { String name = arguments.next(); String test = simplify(name); for (T entry : enumClass.getEnumConstants()) { if (simplify(entry.name()).equalsIgnoreCase(test)) { return entry; } } throw new ArgumentParseException( "No matching value found in the '" + enumClass.getSimpleName() + "' list."); } }
EnumProvider implements Provider<T> { @Nullable @Override public T get(CommandArgs arguments, List<? extends Annotation> modifiers) throws ArgumentException, ProvisionException { String name = arguments.next(); String test = simplify(name); for (T entry : enumClass.getEnumConstants()) { if (simplify(entry.name()).equalsIgnoreCase(test)) { return entry; } } throw new ArgumentParseException( "No matching value found in the '" + enumClass.getSimpleName() + "' list."); } EnumProvider(Class<T> enumClass); }
EnumProvider implements Provider<T> { @Nullable @Override public T get(CommandArgs arguments, List<? extends Annotation> modifiers) throws ArgumentException, ProvisionException { String name = arguments.next(); String test = simplify(name); for (T entry : enumClass.getEnumConstants()) { if (simplify(entry.name()).equalsIgnoreCase(test)) { return entry; } } throw new ArgumentParseException( "No matching value found in the '" + enumClass.getSimpleName() + "' list."); } EnumProvider(Class<T> enumClass); @Override String getName(); @Nullable @Override T get(CommandArgs arguments, List<? extends Annotation> modifiers); @Override List<String> getSuggestions(
      String prefix, Namespace namespace, List<? extends Annotation> modifiers); }
EnumProvider implements Provider<T> { @Nullable @Override public T get(CommandArgs arguments, List<? extends Annotation> modifiers) throws ArgumentException, ProvisionException { String name = arguments.next(); String test = simplify(name); for (T entry : enumClass.getEnumConstants()) { if (simplify(entry.name()).equalsIgnoreCase(test)) { return entry; } } throw new ArgumentParseException( "No matching value found in the '" + enumClass.getSimpleName() + "' list."); } EnumProvider(Class<T> enumClass); @Override String getName(); @Nullable @Override T get(CommandArgs arguments, List<? extends Annotation> modifiers); @Override List<String> getSuggestions(
      String prefix, Namespace namespace, List<? extends Annotation> modifiers);  }