Debian Codegraph @

src/com/adobe/internal/xmp/impl/QName.java

raw symbols SCIP
1 // =================================================================================================
2 // ADOBE SYSTEMS INCORPORATED
3 // Copyright 2006 Adobe Systems Incorporated
4 // All Rights Reserved
5 //
6 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms
7 // of the Adobe license agreement accompanying it.
8 // =================================================================================================
9
10 package com.adobe.internal.xmp.impl;
11
12 /**
13 * @author Stefan Makswit
14 * @version $Revision$
15 * @since 09.11.2006
16 */
17 public class QName
18 {
19 /** XML namespace prefix */
20 private String prefix;
21 /** XML localname */
22 private String localName;
23
24
25 /**
26 * Splits a qname into prefix and localname.
27 * @param qname a QName
28 */
29 public QName(String qname)
30 {
31 int colon = qname.indexOf(':');
32
33 if (colon >= 0)
34 {
35 prefix = qname.substring(0, colon);
36 localName = qname.substring(colon + 1);
37 }
38 else
39 {
40 prefix = "";
41 localName = qname;
42 }
43 }
44
45
46 /** Constructor that initializes the fields
47 * @param prefix the prefix
48 * @param localName the name
49 */
50 public QName(String prefix, String localName)
51 {
52 this.prefix = prefix;
53 this.localName = localName;
54 }
55
56
57 /**
58 * @return Returns whether the QName has a prefix.
59 */
60 public boolean hasPrefix()
61 {
62 return prefix != null && prefix.length() > 0;
63 }
64
65
66 /**
67 * @return the localName
68 */
69 public String getLocalName()
70 {
71 return localName;
72 }
73
74
75 /**
76 * @return the prefix
77 */
78 public String getPrefix()
79 {
80 return prefix;
81 }
82 }