File tree Expand file tree Collapse file tree 4 files changed +190
-204
lines changed
src/main/java/org/springframework/data/redis/listener Expand file tree Collapse file tree 4 files changed +190
-204
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright 2017- 2023 the original author or authors.
2+ * Copyright 2023 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
1616package org .springframework .data .redis .listener ;
1717
1818import org .springframework .lang .Nullable ;
19- import org .springframework .util .Assert ;
2019import org .springframework .util .ObjectUtils ;
2120
2221/**
2322 * Abstract base class for defining {@link Topic Topics}.
2423 *
2524 * @author John Blum
26- * @see org.springframework.data.redis.listener.Topic
27- * @since 3.2.0
25+ * @since 3.1.3
2826 */
2927abstract class AbstractTopic implements Topic {
3028
3129 private final String name ;
3230
33- AbstractTopic (String label , String name ) {
34- Assert .notNull (name ,() -> label + " must not be null" );
31+ AbstractTopic (String name ) {
3532 this .name = name ;
3633 }
3734
Original file line number Diff line number Diff line change 1515 */
1616package org .springframework .data .redis .listener ;
1717
18+ import org .springframework .util .Assert ;
19+
1820/**
1921 * {@link Topic Channel Topic} implementation mapping to a Redis channel.
2022 *
2527public class ChannelTopic extends AbstractTopic {
2628
2729 /**
28- * Create a new {@link ChannelTopic} for channel subscriptions .
30+ * Constructs a new {@link ChannelTopic} instance .
2931 *
30- * @param channelName {@link String name} of the Redis channel; must not be {@literal null} or {@literal empty}.
31- * @return the {@link ChannelTopic} for the given {@code channelName}.
32- * @since 2.1
32+ * @param channelName must not be {@literal null}.
3333 */
34- public static ChannelTopic of (String channelName ) {
35- return new ChannelTopic (channelName );
34+ public ChannelTopic (String channelName ) {
35+
36+ super (channelName );
37+ Assert .notNull (channelName , "Channel name must not be null" );
3638 }
3739
3840 /**
39- * Constructs a new {@link ChannelTopic} instance .
41+ * Create a new {@link ChannelTopic} for channel subscriptions .
4042 *
41- * @param channelName must not be {@literal null}.
43+ * @param channelName {@link String name} of the Redis channel; must not be {@literal null}.
44+ * @return the {@link ChannelTopic} for the given {@code channelName}.
45+ * @since 2.1
4246 */
43- public ChannelTopic (String channelName ) {
44- super ( "Topic name" , channelName );
47+ public static ChannelTopic of (String channelName ) {
48+ return new ChannelTopic ( channelName );
4549 }
4650}
Original file line number Diff line number Diff line change 1515 */
1616package org .springframework .data .redis .listener ;
1717
18+ import org .springframework .util .Assert ;
19+
1820/**
1921 * {@link Topic} {@link String pattern} matching multiple Redis channels.
2022 *
2527public class PatternTopic extends AbstractTopic {
2628
2729 /**
28- * Create a new {@link PatternTopic} for channel subscriptions based on a {@code pattern} .
30+ * Constructs a new {@link PatternTopic} instance .
2931 *
30- * @param pattern {@link String pattern} used to match channels; must not be {@literal null} or {@literal empty}.
31- * @return the {@link PatternTopic} for the given {@code pattern}.
32- * @since 2.1
32+ * @param channelPattern must not be {@literal null}.
3333 */
34- public static PatternTopic of (String pattern ) {
35- return new PatternTopic (pattern );
34+ public PatternTopic (String channelPattern ) {
35+
36+ super (channelPattern );
37+ Assert .notNull (channelPattern , "Pattern must not be null" );
3638 }
3739
3840 /**
39- * Constructs a new {@link PatternTopic} instance .
41+ * Create a new {@link PatternTopic} for channel subscriptions based on a {@code pattern} .
4042 *
41- * @param channelPattern must not be {@literal null}.
43+ * @param pattern {@link String pattern} used to match channels; must not be {@literal null} or empty.
44+ * @return the {@link PatternTopic} for the given {@code pattern}.
45+ * @since 2.1
4246 */
43- public PatternTopic (String channelPattern ) {
44- super ( "Pattern" , channelPattern );
47+ public static PatternTopic of (String pattern ) {
48+ return new PatternTopic ( pattern );
4549 }
4650}
You can’t perform that action at this time.
0 commit comments