Clover Coverage Report - JmDNS 3.4.1
Coverage timestamp: Thu Aug 25 2011 13:06:33 CEST
../../../img/srcFileCovDistChart10.png 0% of files have more coverage
20   124   7   2.86
0   50   0.35   7
7     1  
1    
 
  ServiceEventImpl       Line # 19 20 0% 7 0 100% 1.0
 
  (19)
 
1    // /Copyright 2003-2005 Arthur van Hoff, Rick Blair
2    // Licensed under Apache License version 2.0
3    // Original license LGPL
4   
5    package javax.jmdns.impl;
6   
7    import javax.jmdns.JmDNS;
8    import javax.jmdns.ServiceEvent;
9    import javax.jmdns.ServiceInfo;
10   
11    /**
12    * ServiceEvent.
13    *
14    * @author Werner Randelshofer, Rick Blair
15    */
16    /**
17    *
18    */
 
19    public class ServiceEventImpl extends ServiceEvent {
20    /**
21    *
22    */
23    private static final long serialVersionUID = 7107973622016897488L;
24    // private static Logger logger = Logger.getLogger(ServiceEvent.class.getName());
25    /**
26    * The type name of the service.
27    */
28    private final String _type;
29    /**
30    * The instance name of the service. Or null, if the event was fired to a service type listener.
31    */
32    private final String _name;
33    /**
34    * The service info record, or null if the service could be be resolved. This is also null, if the event was fired to a service type listener.
35    */
36    private final ServiceInfo _info;
37   
38    /**
39    * Creates a new instance.
40    *
41    * @param jmDNS
42    * the JmDNS instance which originated the event.
43    * @param type
44    * the type name of the service.
45    * @param name
46    * the instance name of the service.
47    * @param info
48    * the service info record, or null if the service could be be resolved.
49    */
 
50  229 toggle public ServiceEventImpl(JmDNSImpl jmDNS, String type, String name, ServiceInfo info) {
51  227 super(jmDNS);
52  229 this._type = type;
53  228 this._name = name;
54  229 this._info = info;
55    }
56   
57    /*
58    * (non-Javadoc)
59    * @see javax.jmdns.ServiceEvent#getDNS()
60    */
 
61  31 toggle @Override
62    public JmDNS getDNS() {
63  31 return (JmDNS) getSource();
64    }
65   
66    /*
67    * (non-Javadoc)
68    * @see javax.jmdns.ServiceEvent#getType()
69    */
 
70  326 toggle @Override
71    public String getType() {
72  327 return _type;
73    }
74   
75    /*
76    * (non-Javadoc)
77    * @see javax.jmdns.ServiceEvent#getName()
78    */
 
79  290 toggle @Override
80    public String getName() {
81  290 return _name;
82    }
83   
84    /*
85    * (non-Javadoc)
86    * @see java.util.EventObject#toString()
87    */
 
88  7 toggle @Override
89    public String toString() {
90  7 StringBuilder buf = new StringBuilder();
91  7 buf.append("[" + this.getClass().getSimpleName() + "@" + System.identityHashCode(this) + " ");
92  7 buf.append("\n\tname: '");
93  7 buf.append(this.getName());
94  7 buf.append("' type: '");
95  7 buf.append(this.getType());
96  7 buf.append("' info: '");
97  7 buf.append(this.getInfo());
98  7 buf.append("']");
99    // buf.append("' source: ");
100    // buf.append("\n\t" + source + "");
101    // buf.append("\n]");
102  7 return buf.toString();
103    }
104   
105    /*
106    * (non-Javadoc)
107    * @see javax.jmdns.ServiceEvent#getInfo()
108    */
 
109  304 toggle @Override
110    public ServiceInfo getInfo() {
111  305 return _info;
112    }
113   
114    /*
115    * (non-Javadoc)
116    * @see javax.jmdns.ServiceEvent#clone()
117    */
 
118  14 toggle @Override
119    public ServiceEventImpl clone() {
120  14 ServiceInfoImpl newInfo = new ServiceInfoImpl(this.getInfo());
121  14 return new ServiceEventImpl((JmDNSImpl) this.getDNS(), this.getType(), this.getName(), newInfo);
122    }
123   
124    }