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 @@ -79,8 +79,8 @@ public FilteringWebHandler(List<GlobalFilter> globalFilters, boolean routeFilter
private static List<GatewayFilter> loadFilters(List<GlobalFilter> filters) {
return filters.stream().map(filter -> {
GatewayFilterAdapter gatewayFilter = new GatewayFilterAdapter(filter);
if (filter instanceof Ordered) {
int order = ((Ordered) filter).getOrder();
if (filter instanceof Ordered ordered) {
int order = ordered.getOrder();
return new OrderedGatewayFilter(gatewayFilter, order);
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ List<GatewayFilter> loadGatewayFilters(String id, List<FilterDefinition> filterD

// some filters require routeId
// TODO: is there a better place to apply this?
if (configuration instanceof HasRouteId) {
HasRouteId hasRouteId = (HasRouteId) configuration;
if (configuration instanceof HasRouteId hasRouteId) {
hasRouteId.setRouteId(id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ public RouteRefreshListener(ApplicationEventPublisher publisher) {

@Override
public void onApplicationEvent(ApplicationEvent event) {
if (event instanceof ContextRefreshedEvent) {
ContextRefreshedEvent refreshedEvent = (ContextRefreshedEvent) event;
if (event instanceof ContextRefreshedEvent refreshedEvent) {
boolean isManagementCtxt = WebServerApplicationContext
.hasServerNamespace(refreshedEvent.getApplicationContext(), "management");
boolean isLoadBalancerCtxt = refreshedEvent.getApplicationContext().getDisplayName() != null
Expand All @@ -58,13 +57,11 @@ public void onApplicationEvent(ApplicationEvent event) {
else if (event instanceof RefreshScopeRefreshedEvent || event instanceof InstanceRegisteredEvent) {
reset();
}
else if (event instanceof ParentHeartbeatEvent) {
ParentHeartbeatEvent e = (ParentHeartbeatEvent) event;
resetIfNeeded(e.getValue());
else if (event instanceof ParentHeartbeatEvent parentHeartbeatEvent) {
resetIfNeeded(parentHeartbeatEvent.getValue());
}
else if (event instanceof HeartbeatEvent) {
HeartbeatEvent e = (HeartbeatEvent) event;
resetIfNeeded(e.getValue());
else if (event instanceof HeartbeatEvent heartbeatEvent) {
resetIfNeeded(heartbeatEvent.getValue());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ public boolean supportsParameter(MethodParameter parameter) {

private Type type(MethodParameter parameter) {
Type type = parameter.getGenericParameterType();
if (type instanceof ParameterizedType) {
ParameterizedType param = (ParameterizedType) type;
if (type instanceof ParameterizedType param) {
type = param.getActualTypeArguments()[0];
}
if (type instanceof TypeVariable || type instanceof WildcardType) {
Expand Down