Announcement Announcement Module
Collapse
No announcement yet.
SpEL, Enum and Filters Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SpEL, Enum and Filters

    In my payload, one of the property is of Enum type. Is it possible to use SpEL expression to filter the messages based on the enum property value?

  • #2
    Sure you can
    For example
    Code:
    public enum Day {
    	SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
        THURSDAY, FRIDAY, SATURDAY 
    }
    
    <int:filter input-channel="inChannel" output-channel="loggingChannel" expression="payload.equals(T(foo.bar.Day).MONDAY)"/>
    	
    <int:logging-channel-adapter id="loggingChannel" level="WARN"/>
    
    MessageChannel channel = context.getBean("inChannel", MessageChannel.class);
    channel.send(new GenericMessage<Day>(Day.MONDAY));

    Comment

    Working...
    X