EMMA Coverage Report (generated Thu Jan 20 11:39:44 EST 2011)
[all classes][com.hammurapi.common]

COVERAGE SUMMARY FOR SOURCE FILE [SimpleObservableConverter.java]

nameclass, %method, %block, %line, %
SimpleObservableConverter.java100% (1/1)100% (2/2)30%  (9/30)38%  (3/8)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SimpleObservableConverter100% (1/1)100% (2/2)30%  (9/30)38%  (3/8)
convert (Object): Observable 100% (1/1)22%  (6/27)29%  (2/7)
SimpleObservableConverter (): void 100% (1/1)100% (3/3)100% (1/1)

1package com.hammurapi.common;
2 
3/**
4 * Converts argument to com.hammurapi.common.Observable. If argument is instance
5 * of com.hammurapi.common.Observable, it is returned as is. If argument is instance 
6 * of java.util.Observable, it is adapted to com.hammurapi.common.Observable. If argument
7 * is instance of com.hammurapi.common.Adaptable, then its getAdapter() method is invoked to
8 * get com.hammurapi.common.Observable adapter.
9 * @author Pavel Vlasov
10 *
11 * @param <T>
12 */
13public class SimpleObservableConverter<T> implements ObservableConverter<T> {
14 
15        /**
16         * @param obj
17         * @return Observable or null if argument cannot be converted to observable.
18         */
19        @Override
20        public Observable<T> convert(T obj) {
21                if (obj instanceof Observable) {
22                        return (Observable<T>) obj;
23                }
24                
25                if (obj instanceof java.util.Observable) {
26                        return (Observable<T>) new ObservableAdapter((java.util.Observable) obj);
27                }
28                
29                if (obj instanceof Adaptable) {
30                        return ((Adaptable) obj).getAdapter(Observable.class, DefaultContext.INSTANCE);
31                }
32                
33                return null;
34        }
35 
36}

[all classes][com.hammurapi.common]
EMMA 2.0.5312 EclEmma Fix 2 (C) Vladimir Roubtsov