DATAREDIS-612 - Polishing.

Introduce factory methods for ChannelTopic and PatternTopic.

Original Pull Request: #295
This commit is contained in:
Mark Paluch
2018-04-26 09:20:04 +02:00
committed by Christoph Strobl
parent d356ade624
commit a3b96add06
5 changed files with 36 additions and 14 deletions

View File

@@ -42,6 +42,17 @@ public class ChannelTopic implements Topic {
this.channelName = name;
}
/**
* Create a new {@link ChannelTopic} for channel subscriptions.
*
* @param name the channel name, must not be {@literal null} or empty.
* @return the {@link ChannelTopic} for {@code channelName}.
* @since 2.1
*/
public static ChannelTopic of(String name) {
return new ChannelTopic(name);
}
/**
* @return topic name.
*/

View File

@@ -42,6 +42,17 @@ public class PatternTopic implements Topic {
this.channelPattern = pattern;
}
/**
* Create a new {@link PatternTopic} for channel subscriptions based on a {@code pattern}.
*
* @param pattern the channel pattern, must not be {@literal null} or empty.
* @return the {@link PatternTopic} for {@code pattern}.
* @since 2.1
*/
static PatternTopic of(String pattern) {
return new PatternTopic(pattern);
}
/**
* @return channel pattern.
*/