EMMA Coverage Report (generated Tue Oct 28 00:01:11 GMT 2008)
[all classes][org.joda.time.convert]

COVERAGE SUMMARY FOR SOURCE FILE [NullConverter.java]

nameclass, %method, %block, %line, %
NullConverter.java100% (1/1)100% (6/6)100% (27/27)100% (11/11)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class NullConverter100% (1/1)100% (6/6)100% (27/27)100% (11/11)
<static initializer> 100% (1/1)100% (5/5)100% (1/1)
NullConverter (): void 100% (1/1)100% (3/3)100% (2/2)
getDurationMillis (Object): long 100% (1/1)100% (2/2)100% (1/1)
getSupportedType (): Class 100% (1/1)100% (2/2)100% (1/1)
setInto (ReadWritableInterval, Object, Chronology): void 100% (1/1)100% (10/10)100% (4/4)
setInto (ReadWritablePeriod, Object, Chronology): void 100% (1/1)100% (5/5)100% (2/2)

1/*
2 *  Copyright 2001-2005 Stephen Colebourne
3 *
4 *  Licensed under the Apache License, Version 2.0 (the "License");
5 *  you may not use this file except in compliance with the License.
6 *  You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 *  Unless required by applicable law or agreed to in writing, software
11 *  distributed under the License is distributed on an "AS IS" BASIS,
12 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 *  See the License for the specific language governing permissions and
14 *  limitations under the License.
15 */
16package org.joda.time.convert;
17 
18import org.joda.time.Chronology;
19import org.joda.time.DateTimeUtils;
20import org.joda.time.Period;
21import org.joda.time.ReadWritableInterval;
22import org.joda.time.ReadWritablePeriod;
23 
24/**
25 * NullConverter converts null to an instant, partial, duration, period
26 * or interval. Null means now for instant/partial, zero for duration/period
27 * and from now to now for interval.
28 *
29 * @author Stephen Colebourne
30 * @author Brian S O'Neill
31 * @since 1.0
32 */
33class NullConverter extends AbstractConverter
34        implements InstantConverter, PartialConverter, DurationConverter, PeriodConverter, IntervalConverter {
35 
36    /**
37     * Singleton instance.
38     */
39    static final NullConverter INSTANCE = new NullConverter();
40 
41    /**
42     * Restricted constructor.
43     */
44    protected NullConverter() {
45        super();
46    }
47 
48    //-----------------------------------------------------------------------
49    /**
50     * Gets the millisecond duration, which is zero.
51     * 
52     * @param object  the object to convert, which is null
53     * @return the millisecond duration
54     */
55    public long getDurationMillis(Object object) {
56        return 0L;
57    }
58 
59    //-----------------------------------------------------------------------
60    /**
61     * Sets the given ReadWritableDuration to zero milliseconds.
62     *
63     * @param duration duration to get modified
64     * @param object  the object to convert, which is null
65     * @param chrono  the chronology to use
66     * @throws NullPointerException if the duration is null
67     */
68    public void setInto(ReadWritablePeriod duration, Object object, Chronology chrono) {
69        duration.setPeriod((Period) null);
70    }
71 
72    //-----------------------------------------------------------------------
73    /**
74     * Extracts interval endpoint values from an object of this converter's
75     * type, and sets them into the given ReadWritableInterval.
76     *
77     * @param writableInterval interval to get modified, not null
78     * @param object  the object to convert, which is null
79     * @param chrono  the chronology to use, may be null
80     * @throws NullPointerException if the interval is null
81     */
82    public void setInto(ReadWritableInterval writableInterval, Object object, Chronology chrono) {
83        writableInterval.setChronology(chrono);
84        long now = DateTimeUtils.currentTimeMillis();
85        writableInterval.setInterval(now, now);
86    }
87 
88    //-----------------------------------------------------------------------
89    /**
90     * Returns null.
91     * 
92     * @return null
93     */
94    public Class getSupportedType() {
95        return null;
96    }
97 
98}

[all classes][org.joda.time.convert]
EMMA 2.0.5312 (C) Vladimir Roubtsov