@Test(expected=IllegalArgumentException.class) public void failOnCreationWithEmptyParameterName() { ImmutableQueryParameter.create(" ", ImmutableList.of("value1")); }
static ImmutableQueryParameter create(String name, Collection<?> rawValues) { checkNotNull(name,"Parameter name cannot be null"); checkArgument(!name.trim().isEmpty(),"Parameter name cannot be empty"); checkNotNull(rawValues,"Raw values cannot be null"); checkArgument(!rawValues.isEmpty(),"No raw values specified"); Builder<String> strRawValues=ImmutableList.<String>builder(); for(Object rawValue:rawValues) { strRawValues.add(rawValue.toString()); } return new ImmutableQueryParameter(name, strRawValues.build()); }
ImmutableQueryParameter implements Parameter { static ImmutableQueryParameter create(String name, Collection<?> rawValues) { checkNotNull(name,"Parameter name cannot be null"); checkArgument(!name.trim().isEmpty(),"Parameter name cannot be empty"); checkNotNull(rawValues,"Raw values cannot be null"); checkArgument(!rawValues.isEmpty(),"No raw values specified"); Builder<String> strRawValues=ImmutableList.<String>builder(); for(Object rawValue:rawValues) { strRawValues.add(rawValue.toString()); } return new ImmutableQueryParameter(name, strRawValues.build()); } }
ImmutableQueryParameter implements Parameter { static ImmutableQueryParameter create(String name, Collection<?> rawValues) { checkNotNull(name,"Parameter name cannot be null"); checkArgument(!name.trim().isEmpty(),"Parameter name cannot be empty"); checkNotNull(rawValues,"Raw values cannot be null"); checkArgument(!rawValues.isEmpty(),"No raw values specified"); Builder<String> strRawValues=ImmutableList.<String>builder(); for(Object rawValue:rawValues) { strRawValues.add(rawValue.toString()); } return new ImmutableQueryParameter(name, strRawValues.build()); } private  ImmutableQueryParameter(String name, ImmutableList<String> rawValues); }
ImmutableQueryParameter implements Parameter { static ImmutableQueryParameter create(String name, Collection<?> rawValues) { checkNotNull(name,"Parameter name cannot be null"); checkArgument(!name.trim().isEmpty(),"Parameter name cannot be empty"); checkNotNull(rawValues,"Raw values cannot be null"); checkArgument(!rawValues.isEmpty(),"No raw values specified"); Builder<String> strRawValues=ImmutableList.<String>builder(); for(Object rawValue:rawValues) { strRawValues.add(rawValue.toString()); } return new ImmutableQueryParameter(name, strRawValues.build()); } private  ImmutableQueryParameter(String name, ImmutableList<String> rawValues); @Override String name(); @Override boolean isMultivalued(); @Override int cardinality(); @Override String rawValue(); @Override List<String> rawValues(); @Override T rawValueAs(Class<? extends T> clazz); @Override List<T> rawValuesAs(Class<? extends T> clazz); @Override String toString(); }
ImmutableQueryParameter implements Parameter { static ImmutableQueryParameter create(String name, Collection<?> rawValues) { checkNotNull(name,"Parameter name cannot be null"); checkArgument(!name.trim().isEmpty(),"Parameter name cannot be empty"); checkNotNull(rawValues,"Raw values cannot be null"); checkArgument(!rawValues.isEmpty(),"No raw values specified"); Builder<String> strRawValues=ImmutableList.<String>builder(); for(Object rawValue:rawValues) { strRawValues.add(rawValue.toString()); } return new ImmutableQueryParameter(name, strRawValues.build()); } private  ImmutableQueryParameter(String name, ImmutableList<String> rawValues); @Override String name(); @Override boolean isMultivalued(); @Override int cardinality(); @Override String rawValue(); @Override List<String> rawValues(); @Override T rawValueAs(Class<? extends T> clazz); @Override List<T> rawValuesAs(Class<? extends T> clazz); @Override String toString();  }