Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*/
public abstract class RestInterceptor implements HandlerInterceptor {

protected RestfulPatterns restfulPatterns = RestfulPatterns.empty();
protected RestfulPatterns excludePatterns = RestfulPatterns.empty();
RestfulPatterns restfulPatterns = RestfulPatterns.empty();
RestfulPatterns excludePatterns = RestfulPatterns.empty();

@Override
public final boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @author cookie-meringue
* @since 0.1
*/
public class RestInterceptorRegistration {
public final class RestInterceptorRegistration {

private final RestInterceptor restInterceptor;
private final InterceptorRegistration registration;
Expand Down Expand Up @@ -48,7 +48,7 @@ public RestInterceptorRegistration addRestfulPatterns(Collection<RestfulPattern>
* @return this RestInterceptorRegistration instance for method chaining
* @since 1.0.2
*/
public RestInterceptorRegistration addRestfulPatterns(RestfulPatterns restfulPatterns) {
RestInterceptorRegistration addRestfulPatterns(RestfulPatterns restfulPatterns) {
restInterceptor.addRestfulPatterns(restfulPatterns);
registration.addPathPatterns(restfulPatterns.getPaths());
return this;
Expand Down Expand Up @@ -78,7 +78,7 @@ public RestInterceptorRegistration excludeRestfulPatterns(Collection<RestfulPatt
* @return this RestInterceptorRegistration instance for method chaining
* @since 1.0.2
*/
public RestInterceptorRegistration excludeRestfulPatterns(RestfulPatterns excludePatterns) {
RestInterceptorRegistration excludeRestfulPatterns(RestfulPatterns excludePatterns) {
restInterceptor.addExcludePatterns(excludePatterns);
registration.excludePathPatterns(excludePatterns.getPaths());
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @author cookie-meringue
* @since 0.1
*/
public class RestInterceptorRegistry {
public final class RestInterceptorRegistry {

private final InterceptorRegistry registry;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @author cookie-meringue
* @since 0.1
*/
public class RestfulPattern {
public final class RestfulPattern {

private final String path;
private final Set<HttpMethod> methods;
Expand Down Expand Up @@ -73,12 +73,12 @@ public static RestfulPatternBuilder builder() {
* Compare the request URI and HTTP method.
* <p> If the request URI and HTTP method match, return true.
*/
public boolean matches(final HttpServletRequest request) {
boolean matches(final HttpServletRequest request) {
return methods.contains(HttpMethod.valueOf(request.getMethod())) &&
pathMatcher.match(path, request.getRequestURI());
pathMatcher.match(path, request.getRequestURI());
}

public String getPath() {
String getPath() {
return path;
}

Expand Down Expand Up @@ -107,9 +107,9 @@ public int hashCode() {
@Override
public String toString() {
return "RestfulPattern{" +
"methods=" + methods +
", path=" + path +
'}';
"methods=" + methods +
", path=" + path +
'}';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @author cookie-meringue
* @since 1.0.2
*/
public final class RestfulPatterns {
final class RestfulPatterns {

private final List<RestfulPattern> values;

Expand Down Expand Up @@ -52,7 +52,7 @@ static RestfulPatterns from(final Collection<RestfulPattern> values) {
*/
boolean noneMatches(final HttpServletRequest request) {
return values.stream()
.noneMatch(pattern -> pattern.matches(request));
.noneMatch(pattern -> pattern.matches(request));
}

/**
Expand All @@ -64,7 +64,7 @@ boolean noneMatches(final HttpServletRequest request) {
*/
boolean anyMatches(final HttpServletRequest request) {
return values.stream()
.anyMatch(pattern -> pattern.matches(request));
.anyMatch(pattern -> pattern.matches(request));
}

/**
Expand All @@ -83,7 +83,7 @@ void addAll(final RestfulPatterns restfulPatterns) {
*/
List<String> getPaths() {
return values.stream()
.map(RestfulPattern::getPath)
.toList();
.map(RestfulPattern::getPath)
.toList();
}
}
Loading