01: /* Generated By:JJTree: Do not edit this line. ASTAttribute.java */
02:
03: package net.sourceforge.pmd.jsp.ast;
04:
05: public class ASTAttribute extends SimpleNode {
06: /* BEGIN CUSTOM CODE */
07: private String name;
08:
09: /**
10: * @return Returns the name.
11: */
12: public String getName() {
13: return name;
14: }
15:
16: /**
17: * @param name The name to set.
18: */
19: public void setName(String name) {
20: this .name = name;
21: }
22:
23: /**
24: * @return boolean - true if the element has a namespace-prefix, false otherwise
25: */
26: public boolean isHasNamespacePrefix() {
27: return (name.indexOf(':') >= 0);
28: }
29:
30: /**
31: * @return String - the part of the name that is before the (first) colon (":")
32: */
33: public String getNamespacePrefix() {
34: int colonIndex = name.indexOf(':');
35: return ((colonIndex >= 0) ? name.substring(0, colonIndex) : "");
36: }
37:
38: /**
39: * @return String - The part of the name that is after the first colon (":").
40: * If the name does not contain a colon, the full name is returned.
41: */
42: public String getLocalName() {
43: int colonIndex = name.indexOf(':');
44: return ((colonIndex >= 0) ? name.substring(colonIndex + 1)
45: : name);
46: }
47:
48: /* (non-Javadoc)
49: * @see com.applicationengineers.pmd4jsp.ast.SimpleNode#toString(java.lang.String)
50: */
51: public String toString(String prefix) {
52: return super .toString(prefix) + " name=[" + name + "]";
53: }
54:
55: /* END CUSTOM CODE */
56:
57: public ASTAttribute(int id) {
58: super (id);
59: }
60:
61: public ASTAttribute(JspParser p, int id) {
62: super (p, id);
63: }
64:
65: /**
66: * Accept the visitor. *
67: */
68: public Object jjtAccept(JspParserVisitor visitor, Object data) {
69: return visitor.visit(this, data);
70: }
71: }
|