Skip to content

Commit

Permalink
Add builder method that accepts iterable (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
wheelerlaw authored Nov 21, 2020
1 parent c4b27b0 commit 0d442fd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/com/networknt/schema/JsonSchemaFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -88,6 +89,10 @@ public Builder defaultMetaSchemaURI(final String defaultMetaSchemaURI) {
* @return this builder.
*/
public Builder uriFactory(final URIFactory uriFactory, final String... schemes) {
return uriFactory(uriFactory, Arrays.asList(schemes));
}

public Builder uriFactory(final URIFactory uriFactory, final Iterable<String> schemes) {
for (final String scheme : schemes) {
this.uriFactoryMap.put(scheme, uriFactory);
}
Expand All @@ -102,6 +107,10 @@ public Builder uriFactory(final URIFactory uriFactory, final String... schemes)
* @return this builder.
*/
public Builder uriFetcher(final URIFetcher uriFetcher, final String... schemes) {
return uriFetcher(uriFetcher, Arrays.asList(schemes));
}

public Builder uriFetcher(final URIFetcher uriFetcher, final Iterable<String> schemes) {
for (final String scheme : schemes) {
this.uriFetcherMap.put(scheme, uriFetcher);
}
Expand Down

0 comments on commit 0d442fd

Please sign in to comment.