Allow.java revision 600c7a4bbc7348167293eac928192e695b4ad5ba
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* Product of NIST/ITL Advanced Networking Technologies Division (ANTD).        *
26*******************************************************************************/
27package gov.nist.javax.sip.header;
28
29import java.text.ParseException;
30
31/**
32 * Allow SIPHeader.
33 *
34 * @author M. Ranganathan   <br/>
35 * @version 1.2 $Revision: 1.6 $ $Date: 2009/07/17 18:57:26 $
36 * @since 1.1
37 *
38 *
39 */
40public final class Allow extends
41    SIPHeader implements javax.sip.header.AllowHeader {
42
43    /**
44     * Comment for <code>serialVersionUID</code>
45     */
46    private static final long serialVersionUID = -3105079479020693930L;
47    /** method field
48     */
49    protected String method;
50
51    /** default constructor
52     */
53    public Allow() {
54        super(ALLOW);
55    }
56
57    /** constructor
58     * @param m String to set
59     */
60    public Allow(String m) {
61        super(ALLOW);
62        method = m;
63    }
64
65    /** get the method field
66     * @return String
67     */
68    public String getMethod() {
69        return method;
70    }
71
72    /**
73     * Set the method member
74     * @param method method to set.
75     */
76    public void setMethod(String method) throws ParseException {
77        if (method == null)
78            throw new NullPointerException(
79                "JAIN-SIP Exception"
80                    + ", Allow, setMethod(), the method parameter is null.");
81        this.method = method;
82    }
83
84    /** Return body encoded in canonical form.
85     * @return body encoded as a string.
86     */
87    protected String encodeBody() {
88        return method;
89    }
90}
91