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*******************************************************************************/
29package gov.nist.javax.sip.header;
30
31import java.text.ParseException;
32
33/**
34 * AllowEvents SIPHeader.
35 *
36 * @author M. Ranganathan  NIST/ITL ANTD. <br/>
37 * @author Olivier Deruelle <br/>
38 *
39 *
40 * @version 1.2 $Revision: 1.7 $ $Date: 2009/07/17 18:57:26 $
41 * @since 1.1
42 */
43public final class AllowEvents
44    extends SIPHeader
45    implements javax.sip.header.AllowEventsHeader {
46
47    /**
48     * Comment for <code>serialVersionUID</code>
49     */
50    private static final long serialVersionUID = 617962431813193114L;
51    /** method field
52     */
53    protected String eventType;
54
55    /** default constructor
56     */
57    public AllowEvents() {
58        super(ALLOW_EVENTS);
59    }
60
61    /** constructor
62     * @param m String to set
63     */
64    public AllowEvents(String m) {
65        super(ALLOW_EVENTS);
66        eventType = m;
67    }
68
69    /**
70     * Sets the eventType defined in this AllowEventsHeader.
71     *
72     * @param eventType - the String defining the method supported
73     * in this AllowEventsHeader
74     * @throws ParseException which signals that an error has been reached
75     * unexpectedly while parsing the Strings defining the eventType supported
76     */
77    public void setEventType(String eventType) throws ParseException {
78        if (eventType == null)
79            throw new NullPointerException(
80                "JAIN-SIP Exception,"
81                    + "AllowEvents, setEventType(), the eventType parameter is null");
82        this.eventType = eventType;
83    }
84
85    /**
86     * Gets the eventType of the AllowEventsHeader.
87     *
88     * @return the String object identifing the eventTypes of AllowEventsHeader.
89     */
90    public String getEventType() {
91        return eventType;
92    }
93
94    /** Return body encoded in canonical form.
95        * @return body encoded as a string.
96        */
97    protected String encodeBody() {
98        return eventType;
99    }
100}
101