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