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.tz;
17:
18: import java.util.Collections;
19: import java.util.Set;
20: import org.joda.time.DateTimeZone;
21:
22: /**
23: * Simple time zone provider that supports only UTC.
24: * <p>
25: * UTCProvider is thread-safe and immutable.
26: *
27: * @author Brian S O'Neill
28: * @since 1.0
29: */
30: public final class UTCProvider implements Provider {
31:
32: /**
33: * Constructor.
34: */
35: public UTCProvider() {
36: super ();
37: }
38:
39: /**
40: * Returns {@link DateTimeZone#UTC UTC} for <code>"UTC"</code>, null
41: * otherwise.
42: */
43: public DateTimeZone getZone(String id) {
44: if ("UTC".equalsIgnoreCase(id)) {
45: return DateTimeZone.UTC;
46: }
47: return null;
48: }
49:
50: /**
51: * Returns a singleton collection containing only <code>"UTC"</code>.
52: */
53: public Set getAvailableIDs() {
54: return Collections.singleton("UTC");
55: }
56:
57: }
|