Subversion Repositories XServices

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
83 brianR 1
/*
2
 *   Copyright 2012 Brian Rosenberger (Brutex Network)
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
 */
16
package net.brutex.xservices.types;
17
 
18
import java.util.TimeZone;
19
 
20
import javax.xml.bind.annotation.XmlElement;
21
import javax.xml.bind.annotation.XmlType;
22
 
23
import net.brutex.xservices.util.BrutexNamespaces;
24
 
25
/**
26
 * Different pre-defined date formats.
27
 *
28
 * @author Brian Rosenberger, bru@brutex.de
29
 */
30
@XmlType(name=TimeZoneType.XML_NAME, namespace=BrutexNamespaces.WS_XSERVICES)
31
public class TimeZoneType {
32
	public static final String XML_NAME = "timezone";
33
	private String id;
34
	private String displayname;
35
	private TimeZone timezone;
36
	private long offset;
37
 
38
	public TimeZoneType(TimeZone timezone) {
39
		this.timezone = timezone;
40
		this.id = timezone.getID();
41
		this.displayname = timezone.getDisplayName();
42
		this.offset = timezone.getRawOffset()/1000;
43
	}
44
	public TimeZoneType() {
45
		this(TimeZone.getDefault());
46
	}
47
 
48
	/**
49
	 * @return the id
50
	 */
51
	@XmlElement
52
	public String getId() {
53
		return id;
54
	}
55
 
56
	/**
57
	 * @return the displayname
58
	 */
59
	@XmlElement
60
	public String getDisplayname() {
61
		return displayname;
62
	}
63
 
64
	/**
65
	 * @return the timezone
66
	 */
67
	public TimeZone getTimezone() {
68
		return timezone;
69
	}
70
 
71
	/**
72
	 * @return the offset
73
	 */
74
	@XmlElement
75
	public long getOffset() {
76
		return offset;
77
	}
78
 
79
 
80
 
81
}