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 javax.sip.*;
32 import javax.sip.header.*;
33 
34 /**
35  * MinExpires SIP Header.
36  *
37  * @version 1.2 $Revision: 1.6 $ $Date: 2009/10/18 13:46:35 $
38  * @since 1.1
39  *
40  * @author M. Ranganathan   <br/>
41  * @author Olivier Deruelle <br/>
42  *
43  *
44  *
45  */
46 public class MinExpires extends SIPHeader implements MinExpiresHeader {
47 
48     /**
49      * Comment for <code>serialVersionUID</code>
50      */
51     private static final long serialVersionUID = 7001828209606095801L;
52     /** expires field
53      */
54     protected int expires;
55 
56     /** default constructor
57      */
MinExpires()58     public MinExpires() {
59         super(NAME);
60     }
61 
62     /**
63      * Return canonical form.
64      * @return String
65      */
encodeBody()66     public String encodeBody() {
67         return Integer.toString(expires);
68     }
69 
70     /**
71      * Gets the expires value of the ExpiresHeader. This expires value is
72      * relative time.
73      *
74      * @return the expires value of the ExpiresHeader.
75      *
76      */
getExpires()77     public int getExpires() {
78         return expires;
79     }
80 
81     /**
82      * Sets the relative expires value of the ExpiresHeader.
83      * The expires value MUST be greater than zero and MUST be
84      * less than 2**31.
85      *
86      * @param expires - the new expires value of this ExpiresHeader
87      *
88      * @throws InvalidArgumentException if supplied value is less than zero.
89      *
90      *
91      *
92      */
setExpires(int expires)93     public void setExpires(int expires) throws InvalidArgumentException {
94         if (expires < 0)
95             throw new InvalidArgumentException("bad argument " + expires);
96         this.expires = expires;
97     }
98 
99 }
100 /*
101  * $Log: MinExpires.java,v $
102  * Revision 1.6  2009/10/18 13:46:35  deruelle_jean
103  * FindBugs Fixes (Category Performance Warnings)
104  *
105  * Issue number:
106  * Obtained from:
107  * Submitted by: Jean Deruelle
108  * Reviewed by:
109  *
110  * Revision 1.5  2009/07/17 18:57:32  emcho
111  * Converts indentation tabs to spaces so that we have a uniform indentation policy in the whole project.
112  *
113  * Revision 1.4  2006/07/13 09:01:20  mranga
114  * Issue number:
115  * Obtained from:
116  * Submitted by:  jeroen van bemmel
117  * Reviewed by:   mranga
118  * Moved some changes from jain-sip-1.2 to java.net
119  *
120  * CVS: ----------------------------------------------------------------------
121  * CVS: Issue number:
122  * CVS:   If this change addresses one or more issues,
123  * CVS:   then enter the issue number(s) here.
124  * CVS: Obtained from:
125  * CVS:   If this change has been taken from another system,
126  * CVS:   then name the system in this line, otherwise delete it.
127  * CVS: Submitted by:
128  * CVS:   If this code has been contributed to the project by someone else; i.e.,
129  * CVS:   they sent us a patch or a set of diffs, then include their name/email
130  * CVS:   address here. If this is your work then delete this line.
131  * CVS: Reviewed by:
132  * CVS:   If we are doing pre-commit code reviews and someone else has
133  * CVS:   reviewed your changes, include their name(s) here.
134  * CVS:   If you have not had it reviewed then delete this line.
135  *
136  * Revision 1.3  2006/06/19 06:47:26  mranga
137  * javadoc fixups
138  *
139  * Revision 1.2  2006/06/16 15:26:28  mranga
140  * Added NIST disclaimer to all public domain files. Clean up some javadoc. Fixed a leak
141  *
142  * Revision 1.1.1.1  2005/10/04 17:12:34  mranga
143  *
144  * Import
145  *
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  */
172