File tree 4 files changed +190
-204
lines changed
src/main/java/org/springframework/data/redis/listener
4 files changed +190
-204
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2017- 2023 the original author or authors.
2
+ * Copyright 2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
16
16
package org .springframework .data .redis .listener ;
17
17
18
18
import org .springframework .lang .Nullable ;
19
- import org .springframework .util .Assert ;
20
19
import org .springframework .util .ObjectUtils ;
21
20
22
21
/**
23
22
* Abstract base class for defining {@link Topic Topics}.
24
23
*
25
24
* @author John Blum
26
- * @see org.springframework.data.redis.listener.Topic
27
- * @since 3.2.0
25
+ * @since 3.1.3
28
26
*/
29
27
abstract class AbstractTopic implements Topic {
30
28
31
29
private final String name ;
32
30
33
- AbstractTopic (String label , String name ) {
34
- Assert .notNull (name ,() -> label + " must not be null" );
31
+ AbstractTopic (String name ) {
35
32
this .name = name ;
36
33
}
37
34
Original file line number Diff line number Diff line change 15
15
*/
16
16
package org .springframework .data .redis .listener ;
17
17
18
+ import org .springframework .util .Assert ;
19
+
18
20
/**
19
21
* {@link Topic Channel Topic} implementation mapping to a Redis channel.
20
22
*
25
27
public class ChannelTopic extends AbstractTopic {
26
28
27
29
/**
28
- * Create a new {@link ChannelTopic} for channel subscriptions .
30
+ * Constructs a new {@link ChannelTopic} instance .
29
31
*
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}.
33
33
*/
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" );
36
38
}
37
39
38
40
/**
39
- * Constructs a new {@link ChannelTopic} instance .
41
+ * Create a new {@link ChannelTopic} for channel subscriptions .
40
42
*
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
42
46
*/
43
- public ChannelTopic (String channelName ) {
44
- super ( "Topic name" , channelName );
47
+ public static ChannelTopic of (String channelName ) {
48
+ return new ChannelTopic ( channelName );
45
49
}
46
50
}
Original file line number Diff line number Diff line change 15
15
*/
16
16
package org .springframework .data .redis .listener ;
17
17
18
+ import org .springframework .util .Assert ;
19
+
18
20
/**
19
21
* {@link Topic} {@link String pattern} matching multiple Redis channels.
20
22
*
25
27
public class PatternTopic extends AbstractTopic {
26
28
27
29
/**
28
- * Create a new {@link PatternTopic} for channel subscriptions based on a {@code pattern} .
30
+ * Constructs a new {@link PatternTopic} instance .
29
31
*
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}.
33
33
*/
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" );
36
38
}
37
39
38
40
/**
39
- * Constructs a new {@link PatternTopic} instance .
41
+ * Create a new {@link PatternTopic} for channel subscriptions based on a {@code pattern} .
40
42
*
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
42
46
*/
43
- public PatternTopic (String channelPattern ) {
44
- super ( "Pattern" , channelPattern );
47
+ public static PatternTopic of (String pattern ) {
48
+ return new PatternTopic ( pattern );
45
49
}
46
50
}
You can’t perform that action at this time.
0 commit comments