import static java.util.Objects.requireNonNull;
import com.google.common.base.MoreObjects;
+import com.google.common.base.MoreObjects.ToStringHelper;
import java.time.Instant;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
/**
* Features of subscribing part of both notifications.
*/
-abstract class AbstractCommonSubscriber<P, T> extends AbstractNotificationsData implements BaseListenerInterface {
+abstract class AbstractCommonSubscriber<T> extends AbstractNotificationsData implements BaseListenerInterface {
private static final Logger LOG = LoggerFactory.getLogger(AbstractCommonSubscriber.class);
private static final DateTimeFormatter FORMATTER = new DateTimeFormatterBuilder()
.appendValue(ChronoField.YEAR, 4).appendLiteral('-')
private final EventFormatterFactory<T> formatterFactory;
private final NotificationOutputType outputType;
private final String streamName;
- private final P path;
@GuardedBy("this")
private final Set<StreamSessionHandler> subscribers = new HashSet<>();
private boolean changedLeafNodesOnly = false;
private EventFormatter<T> formatter;
- AbstractCommonSubscriber(final QName lastQName, final String streamName, final P path,
- final NotificationOutputType outputType, final EventFormatterFactory<T> formatterFactory) {
+ AbstractCommonSubscriber(final QName lastQName, final String streamName, final NotificationOutputType outputType,
+ final EventFormatterFactory<T> formatterFactory) {
super(lastQName);
this.streamName = requireNonNull(streamName);
checkArgument(!streamName.isEmpty());
- this.path = requireNonNull(path);
this.outputType = requireNonNull(outputType);
this.formatterFactory = requireNonNull(formatterFactory);
}
}
- final P path() {
- return path;
- }
-
/**
* Check whether this query should only notify about leaf node changes.
*
@Override
public final String toString() {
- return MoreObjects.toStringHelper(this)
- .add("path", path)
- .add("stream-name", streamName)
- .add("output-type", getOutputType())
- .toString();
+ return addToStringAttributes(MoreObjects.toStringHelper(this)).toString();
+ }
+
+ ToStringHelper addToStringAttributes(final ToStringHelper helper) {
+ return helper.add("stream-name", streamName).add("output-type", getOutputType());
}
/**