Debian Codegraph @

java/gov/nist/javax/sip/parser/ims/PAssertedIdentityParser.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 PT INOVACAO - EST DEPARTMENT *
28 *******************************************/
29
30 package gov.nist.javax.sip.parser.ims;
31
32 import gov.nist.javax.sip.parser.Lexer;
33 import gov.nist.javax.sip.parser.TokenTypes;
34
35 import java.text.ParseException;
36
37 import gov.nist.javax.sip.header.SIPHeader;
38 import gov.nist.javax.sip.header.ims.PAssertedIdentity;
39 import gov.nist.javax.sip.header.ims.PAssertedIdentityList;
40 import gov.nist.javax.sip.header.ims.SIPHeaderNamesIms;
41
42 import gov.nist.javax.sip.parser.AddressParametersParser;
43
44 /**
45 * @author ALEXANDRE MIGUEL SILVA SANTOS
46 */
47
48 public class PAssertedIdentityParser
49 extends AddressParametersParser
50 implements TokenTypes{
51
52 /**
53 * Constructor
54 * @param assertedIdentity - message to parse to set
55 */
56 public PAssertedIdentityParser(String assertedIdentity) {
57 super(assertedIdentity);
58
59 }
60
61 protected PAssertedIdentityParser(Lexer lexer) {
62 super(lexer);
63
64 }
65
66
67 public SIPHeader parse() throws ParseException {
68
69 if (debug)
70 dbg_enter("AssertedIdentityParser.parse");
71
72 PAssertedIdentityList assertedIdList = new PAssertedIdentityList();
73
74 try {
75
76 headerName(TokenTypes.P_ASSERTED_IDENTITY);
77
78 PAssertedIdentity pai = new PAssertedIdentity();
79 pai.setHeaderName(SIPHeaderNamesIms.P_ASSERTED_IDENTITY);
80
81 super.parse(pai);
82 assertedIdList.add(pai);
83
84 this.lexer.SPorHT();
85 while (lexer.lookAhead(0) == ',')
86 {
87 this.lexer.match(',');
88 this.lexer.SPorHT();
89
90 pai = new PAssertedIdentity();
91 super.parse(pai);
92 assertedIdList.add(pai);
93
94 this.lexer.SPorHT();
95 }
96 this.lexer.SPorHT();
97 this.lexer.match('\n');
98
99 return assertedIdList;
100
101 }
102
103 finally {
104 if (debug)
105 dbg_leave("AssertedIdentityParser.parse");
106 }
107 }
108 }