Debian Codegraph @

java/gov/nist/javax/sip/header/SIPDateHeader.java

raw
1 /*
2 * Conditions Of Use
3 *
4 * This software was developed by employees of the National Institute of
5 * Standards and Technology (NIST), an agency of the Federal Government.
6 * Pursuant to title 15 Untied States Code Section 105, works of NIST
7 * employees are not subject to copyright protection in the United States
8 * and are considered to be in the public domain. As a result, a formal
9 * license is not needed to use the software.
10 *
11 * This software is provided by NIST as a service and is expressly
12 * provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
13 * OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
14 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
15 * AND DATA ACCURACY. NIST does not warrant or make any representations
16 * regarding the use of the software or the results thereof, including but
17 * not limited to the correctness, accuracy, reliability or usefulness of
18 * the software.
19 *
20 * Permission to use this software is contingent upon your acceptance
21 * of the terms of this agreement
22 *
23 * .
24 *
25 */
26 /*******************************************************************************
27 * Product of NIST/ITL Advanced Networking Technologies Division (ANTD). *
28 *******************************************************************************/
29 package gov.nist.javax.sip.header;
30
31 import java.util.*;
32 import javax.sip.header.*;
33
34 /**
35 * Date Header.
36 *
37 *@version 1.2 $Revision: 1.6 $ $Date: 2009/07/17 18:57:37 $
38 *
39 *@author M. Ranganathan <br/>
40 *@author Olivier Deruelle <br/>
41 *
42 *
43 */
44 public class SIPDateHeader extends SIPHeader implements DateHeader {
45
46 /**
47 * Comment for <code>serialVersionUID</code>
48 */
49 private static final long serialVersionUID = 1734186339037274664L;
50 /** date field
51 */
52 protected SIPDate date;
53
54 /** Default constructor.
55 */
56 public SIPDateHeader() {
57 super(DATE);
58 }
59
60 /** Encode the header into a String.
61 * @return String
62 */
63 public String encodeBody() {
64 return date.encode();
65 }
66
67 /**
68 * Set the date member
69 * @param d SIPDate to set
70 */
71 public void setDate(SIPDate d) {
72 date = d;
73
74 }
75
76 /**
77 * Sets date of DateHeader. The date is repesented by the Calendar object.
78 *
79 * @param dat the Calendar object date of this header.
80 */
81 public void setDate(Calendar dat) {
82 if (dat != null)
83 date = new SIPDate(dat.getTime().getTime());
84 }
85
86 /**
87 * Gets the date of DateHeader. The date is repesented by the Calender
88 * object.
89 *
90 * @return the Calendar object representing the date of DateHeader
91 */
92 public Calendar getDate() {
93 if (date == null)
94 return null;
95 return date.getJavaCal();
96 }
97
98 public Object clone() {
99 SIPDateHeader retval = (SIPDateHeader) super.clone();
100 if (this.date != null)
101 retval.date = (SIPDate) this.date.clone();
102 return retval;
103 }
104 }
105 /*
106 * $Log: SIPDateHeader.java,v $
107 * Revision 1.6 2009/07/17 18:57:37 emcho
108 * Converts indentation tabs to spaces so that we have a uniform indentation policy in the whole project.
109 *
110 * Revision 1.5 2006/07/13 09:01:23 mranga
111 * Issue number:
112 * Obtained from:
113 * Submitted by: jeroen van bemmel
114 * Reviewed by: mranga
115 * Moved some changes from jain-sip-1.2 to java.net
116 *
117 * CVS: ----------------------------------------------------------------------
118 * CVS: Issue number:
119 * CVS: If this change addresses one or more issues,
120 * CVS: then enter the issue number(s) here.
121 * CVS: Obtained from:
122 * CVS: If this change has been taken from another system,
123 * CVS: then name the system in this line, otherwise delete it.
124 * CVS: Submitted by:
125 * CVS: If this code has been contributed to the project by someone else; i.e.,
126 * CVS: they sent us a patch or a set of diffs, then include their name/email
127 * CVS: address here. If this is your work then delete this line.
128 * CVS: Reviewed by:
129 * CVS: If we are doing pre-commit code reviews and someone else has
130 * CVS: reviewed your changes, include their name(s) here.
131 * CVS: If you have not had it reviewed then delete this line.
132 *
133 * Revision 1.3 2006/06/19 06:47:26 mranga
134 * javadoc fixups
135 *
136 * Revision 1.2 2006/06/16 15:26:28 mranga
137 * Added NIST disclaimer to all public domain files. Clean up some javadoc. Fixed a leak
138 *
139 * Revision 1.1.1.1 2005/10/04 17:12:35 mranga
140 *
141 * Import
142 *
143 *
144 * Revision 1.3 2005/04/16 20:38:50 dmuresan
145 * Canonical clone() implementations for the GenericObject and GenericObjectList hierarchies
146 *
147 * Revision 1.2 2004/01/22 13:26:29 sverker
148 * Issue number:
149 * Obtained from:
150 * Submitted by: sverker
151 * Reviewed by: mranga
152 *
153 * Major reformat of code to conform with style guide. Resolved compiler and javadoc warnings. Added CVS tags.
154 *
155 * CVS: ----------------------------------------------------------------------
156 * CVS: Issue number:
157 * CVS: If this change addresses one or more issues,
158 * CVS: then enter the issue number(s) here.
159 * CVS: Obtained from:
160 * CVS: If this change has been taken from another system,
161 * CVS: then name the system in this line, otherwise delete it.
162 * CVS: Submitted by:
163 * CVS: If this code has been contributed to the project by someone else; i.e.,
164 * CVS: they sent us a patch or a set of diffs, then include their name/email
165 * CVS: address here. If this is your work then delete this line.
166 * CVS: Reviewed by:
167 * CVS: If we are doing pre-commit code reviews and someone else has
168 * CVS: reviewed your changes, include their name(s) here.
169 * CVS: If you have not had it reviewed then delete this line.
170 *
171 */