01: /*
02: * Copyright 2001-2005 Stephen Colebourne
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: */
16: package org.joda.time.convert;
17:
18: import org.joda.time.Chronology;
19: import org.joda.time.ReadWritableInterval;
20:
21: /**
22: * IntervalConverter defines how an object is converted to an interval.
23: *
24: * @author Brian S O'Neill
25: * @author Stephen Colebourne
26: * @since 1.0
27: */
28: public interface IntervalConverter extends Converter {
29:
30: /**
31: * Checks if the input is a ReadableInterval.
32: * <p>
33: * If it is, then the calling code should cast and copy the fields directly.
34: *
35: * @param object the object to convert, must not be null
36: * @param chrono the chronology to use, may be null
37: * @return true if the input is a ReadableInterval
38: * @throws ClassCastException if the object is invalid
39: */
40: boolean isReadableInterval(Object object, Chronology chrono);
41:
42: /**
43: * Extracts interval endpoint values from an object of this converter's
44: * type, and sets them into the given ReadWritableInterval.
45: *
46: * @param writableInterval interval to get modified, not null
47: * @param object the object to convert, must not be null
48: * @param chrono the chronology to use, may be null
49: * @throws ClassCastException if the object is invalid
50: */
51: void setInto(ReadWritableInterval writableInterval, Object object,
52: Chronology chrono);
53:
54: }
|