diff --git a/modules/swagger-models/pom.xml b/modules/swagger-models/pom.xml index 32163a03d3..28cc855ca0 100644 --- a/modules/swagger-models/pom.xml +++ b/modules/swagger-models/pom.xml @@ -46,6 +46,14 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + diff --git a/modules/swagger-models/src/main/java/io/swagger/models/auth/AuthorizationValue.java b/modules/swagger-models/src/main/java/io/swagger/models/auth/AuthorizationValue.java index 4af130c4a9..2d05cb414a 100644 --- a/modules/swagger-models/src/main/java/io/swagger/models/auth/AuthorizationValue.java +++ b/modules/swagger-models/src/main/java/io/swagger/models/auth/AuthorizationValue.java @@ -1,24 +1,25 @@ package io.swagger.models.auth; import java.net.URL; -import java.util.List; +import java.util.Objects; +import java.util.function.Predicate; public class AuthorizationValue { private String value, type, keyName; - private List urls; + private Predicate urlMatcher; public AuthorizationValue() { } - public AuthorizationValue(String keyName, String value, String type, List urls) { + public AuthorizationValue(String keyName, String value, String type, Predicate urlMatcher) { this.setKeyName(keyName); this.setValue(value); this.setType(type); - this.setUrls(urls); + this.setUrlMatcher(urlMatcher); } public AuthorizationValue(String keyName, String value, String type) { - this(keyName, value, type, null); + this(keyName, value, type, url -> true); } public AuthorizationValue value(String value) { @@ -36,8 +37,8 @@ public AuthorizationValue keyName(String keyName) { return this; } - public AuthorizationValue urls(List urls) { - this.urls = urls; + public AuthorizationValue urlMatcher(Predicate urlMatcher) { + setUrlMatcher(urlMatcher); return this; } @@ -65,11 +66,11 @@ public void setKeyName(String keyName) { this.keyName = keyName; } - public List getUrls() { - return urls; + public Predicate getUrlMatcher() { + return urlMatcher; } - public void setUrls(List urls) { - this.urls = urls; + public void setUrlMatcher(Predicate urlMatcher) { + this.urlMatcher = Objects.requireNonNull(urlMatcher); } @Override @@ -79,7 +80,7 @@ public int hashCode() { result = prime * result + ((keyName == null) ? 0 : keyName.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); result = prime * result + ((value == null) ? 0 : value.hashCode()); - result = prime * result + ((urls == null) ? 0 : urls.hashCode()); + result = prime * result + ((urlMatcher == null) ? 0 : urlMatcher.hashCode()); return result; } @@ -116,12 +117,14 @@ public boolean equals(Object obj) { } else if (!value.equals(other.value)) { return false; } - if (urls == null) { - if (other.urls != null) { + if (urlMatcher == null) { + if (other.urlMatcher != null) { + return false; + } + } else if (!urlMatcher.equals(other.urlMatcher)) { + if (!urlMatcher.equals(other.urlMatcher)) { return false; } - } else if (!urls.equals(other.urls)) { - return false; } return true; } diff --git a/pom.xml b/pom.xml index 79b5e8c587..14894e7831 100644 --- a/pom.xml +++ b/pom.xml @@ -129,7 +129,7 @@ 2.7 true - 1.7 + 1.8 UTF-8 1g