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,6 +16,8 @@

package org.springframework.integration.filter;

import org.jspecify.annotations.Nullable;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.context.Lifecycle;
Expand Down Expand Up @@ -53,9 +55,9 @@ public class MessageFilter extends AbstractReplyProducingPostProcessingMessageHa

private boolean throwExceptionOnRejection;

private MessageChannel discardChannel;
private @Nullable MessageChannel discardChannel;

private String discardChannelName;
private @Nullable String discardChannelName;

/**
* Create a MessageFilter that will delegate to the given {@link MessageSelector}.
Expand Down Expand Up @@ -111,7 +113,7 @@ public void setDiscardWithinAdvice(boolean discardWithinAdvice) {
}

@Override
public MessageChannel getDiscardChannel() {
public @Nullable MessageChannel getDiscardChannel() {
String channelName = this.discardChannelName;
if (channelName != null) {
this.discardChannel = getChannelResolver().resolveDestination(channelName);
Expand All @@ -134,15 +136,13 @@ public IntegrationPatternType getIntegrationPatternType() {
protected void doInit() {
Assert.state(!(this.discardChannelName != null && this.discardChannel != null),
"'discardChannelName' and 'discardChannel' are mutually exclusive.");
if (this.selector instanceof AbstractMessageProcessingSelector) {
if (this.selector instanceof AbstractMessageProcessingSelector abstractMessageProcessingSelector) {
ConversionService conversionService = getConversionService();
if (conversionService != null) {
((AbstractMessageProcessingSelector) this.selector).setConversionService(conversionService);
}
abstractMessageProcessingSelector.setConversionService(conversionService);
}
BeanFactory beanFactory = getBeanFactory();
if (this.selector instanceof BeanFactoryAware && beanFactory != null) {
((BeanFactoryAware) this.selector).setBeanFactory(beanFactory);
if (this.selector instanceof BeanFactoryAware beanFactoryAware) {
beanFactoryAware.setBeanFactory(beanFactory);
}
}

Expand All @@ -166,7 +166,7 @@ public boolean isRunning() {
}

@Override
protected Object doHandleRequestMessage(Message<?> message) {
protected @Nullable Object doHandleRequestMessage(Message<?> message) {
if (this.selector.accept(message)) {
return message;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@
public class MethodInvokingSelector extends AbstractMessageProcessingSelector {

public MethodInvokingSelector(Object object, Method method) {
super(new MethodInvokingMessageProcessor<Boolean>(object, method));
super(new MethodInvokingMessageProcessor<>(object, method));
Class<?> returnType = method.getReturnType();
Assert.isTrue(boolean.class.isAssignableFrom(returnType)
|| Boolean.class.isAssignableFrom(returnType),
"MethodInvokingSelector method must return a boolean result.");
}

public MethodInvokingSelector(Object object, String methodName) {
super(new MethodInvokingMessageProcessor<Boolean>(object, methodName));
super(new MethodInvokingMessageProcessor<>(object, methodName));
}

@SuppressWarnings("unchecked")
public MethodInvokingSelector(Object object) {
super(object instanceof MessageProcessor<?> ? (MessageProcessor<Boolean>) object :
new MethodInvokingMessageProcessor<Boolean>(object, Filter.class));
new MethodInvokingMessageProcessor<>(object, Filter.class));
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/**
* Provides classes supporting the filter pattern.
*/
@org.jspecify.annotations.NullMarked
package org.springframework.integration.filter;
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package org.springframework.integration.history;

import org.jspecify.annotations.Nullable;

import org.springframework.integration.support.DefaultMessageBuilderFactory;
import org.springframework.integration.support.MessageBuilderFactory;
import org.springframework.integration.support.management.TrackableComponent;
Expand All @@ -29,7 +31,7 @@
*/
public class HistoryWritingMessagePostProcessor implements MessagePostProcessor {

private volatile TrackableComponent trackableComponent;
private volatile @Nullable TrackableComponent trackableComponent;

private volatile boolean shouldTrack;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public class MessageHistoryConfigurer implements ManageableSmartLifecycle, BeanF

private String[] componentNamePatterns = {"*"};

@SuppressWarnings("NullAway.Init")
private ListableBeanFactory beanFactory;

private boolean autoStartup = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/**
* Provides classes supporting the capture of message history.
*/
@org.jspecify.annotations.NullMarked
package org.springframework.integration.history;