Clover icon

sunshower-sdk

  1. Project Clover database Sat May 12 2018 05:15:40 UTC
  2. Package io.sunshower.sdk.channel

File PublisherChannel.java

 

Coverage histogram

../../../../img/srcFileCovDistChart6.png
26% of files have more coverage

Code metrics

4
6
4
1
34
27
6
1
1.5
4
1.5

Classes

Class Line # Actions
PublisherChannel 8 6 6
0.571428657.1%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    package io.sunshower.sdk.channel;
2   
3    import io.sunshower.lang.Startable;
4    import io.sunshower.lang.Stoppable;
5    import org.reactivestreams.Publisher;
6    import org.reactivestreams.Subscriber;
7   
 
8    public class PublisherChannel<T> implements Channel<T> {
9   
10    final Publisher<T> publisher;
11   
 
12  1 toggle public PublisherChannel(Publisher<T> publisher) {
13  1 this.publisher = publisher;
14    }
15   
 
16  1 toggle @Override
17    public void start() {
18  1 if (publisher instanceof Startable) {
19  1 ((Startable) publisher).start();
20    }
21    }
22   
 
23  0 toggle @Override
24    public void stop() {
25  0 if (publisher instanceof Stoppable) {
26  0 ((Stoppable) publisher).stop();
27    }
28    }
29   
 
30  1 toggle @Override
31    public void subscribe(Subscriber<? super T> s) {
32  1 publisher.subscribe(s);
33    }
34    }