Home | History | Annotate | Download | only in header
      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 
     28 * Product of NIST/ITL Advanced Networking Technologies Division (ANTD).        *
     29 
     30 *******************************************************************************/
     31 
     32 package gov.nist.javax.sip.header;
     33 
     34 import java.text.ParseException;
     35 import javax.sip.header.*;
     36 
     37 /**
     38  * Supported SIP Header.
     39  *
     40  * @version 1.2 $Revision: 1.5 $ $Date: 2009/07/17 18:57:39 $
     41  *
     42  * @author M. Ranganathan   <br/>
     43  * @author Olivier Deruelle <br/>
     44  *
     45  *
     46  *
     47  */
     48 public class Subject extends SIPHeader implements SubjectHeader {
     49 
     50     /**
     51      * Comment for <code>serialVersionUID</code>
     52      */
     53     private static final long serialVersionUID = -6479220126758862528L;
     54     /** subject field
     55      */
     56     protected String subject;
     57 
     58     /** Default Constructor.
     59      */
     60     public Subject() {
     61         super(SUBJECT);
     62     }
     63 
     64     /**
     65      * Generate the canonical form.
     66      * @return String.
     67      */
     68     public String encodeBody() {
     69         if (subject != null) {
     70             return subject;
     71         } else {
     72             return "";
     73         }
     74     }
     75 
     76     /**
     77      * Sets the subject value of the SubjectHeader to the supplied string
     78      * subject value.
     79      *
     80      * @param subject - the new subject value of this header
     81      * @throws ParseException which signals that an error has been reached
     82      * unexpectedly while parsing the subject value.
     83      */
     84     public void setSubject(String subject) throws ParseException {
     85         if (subject == null)
     86             throw new NullPointerException(
     87                 "JAIN-SIP Exception, "
     88                     + " Subject, setSubject(), the subject parameter is null");
     89         this.subject = subject;
     90     }
     91 
     92     /**
     93      * Gets the subject value of SubjectHeader
     94      *
     95      * @return subject of SubjectHeader
     96      */
     97     public String getSubject() {
     98         return subject;
     99     }
    100 
    101 }
    102 /*
    103  * $Log: Subject.java,v $
    104  * Revision 1.5  2009/07/17 18:57:39  emcho
    105  * Converts indentation tabs to spaces so that we have a uniform indentation policy in the whole project.
    106  *
    107  * Revision 1.4  2006/07/13 09:01:21  mranga
    108  * Issue number:
    109  * Obtained from:
    110  * Submitted by:  jeroen van bemmel
    111  * Reviewed by:   mranga
    112  * Moved some changes from jain-sip-1.2 to java.net
    113  *
    114  * CVS: ----------------------------------------------------------------------
    115  * CVS: Issue number:
    116  * CVS:   If this change addresses one or more issues,
    117  * CVS:   then enter the issue number(s) here.
    118  * CVS: Obtained from:
    119  * CVS:   If this change has been taken from another system,
    120  * CVS:   then name the system in this line, otherwise delete it.
    121  * CVS: Submitted by:
    122  * CVS:   If this code has been contributed to the project by someone else; i.e.,
    123  * CVS:   they sent us a patch or a set of diffs, then include their name/email
    124  * CVS:   address here. If this is your work then delete this line.
    125  * CVS: Reviewed by:
    126  * CVS:   If we are doing pre-commit code reviews and someone else has
    127  * CVS:   reviewed your changes, include their name(s) here.
    128  * CVS:   If you have not had it reviewed then delete this line.
    129  *
    130  * Revision 1.3  2006/06/19 06:47:27  mranga
    131  * javadoc fixups
    132  *
    133  * Revision 1.2  2006/06/16 15:26:28  mranga
    134  * Added NIST disclaimer to all public domain files. Clean up some javadoc. Fixed a leak
    135  *
    136  * Revision 1.1.1.1  2005/10/04 17:12:35  mranga
    137  *
    138  * Import
    139  *
    140  *
    141  * Revision 1.2  2004/01/22 13:26:29  sverker
    142  * Issue number:
    143  * Obtained from:
    144  * Submitted by:  sverker
    145  * Reviewed by:   mranga
    146  *
    147  * Major reformat of code to conform with style guide. Resolved compiler and javadoc warnings. Added CVS tags.
    148  *
    149  * CVS: ----------------------------------------------------------------------
    150  * CVS: Issue number:
    151  * CVS:   If this change addresses one or more issues,
    152  * CVS:   then enter the issue number(s) here.
    153  * CVS: Obtained from:
    154  * CVS:   If this change has been taken from another system,
    155  * CVS:   then name the system in this line, otherwise delete it.
    156  * CVS: Submitted by:
    157  * CVS:   If this code has been contributed to the project by someone else; i.e.,
    158  * CVS:   they sent us a patch or a set of diffs, then include their name/email
    159  * CVS:   address here. If this is your work then delete this line.
    160  * CVS: Reviewed by:
    161  * CVS:   If we are doing pre-commit code reviews and someone else has
    162  * CVS:   reviewed your changes, include their name(s) here.
    163  * CVS:   If you have not had it reviewed then delete this line.
    164  *
    165  */
    166