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. ASTElement.java */
5   
6   package net.sourceforge.pmd.lang.jsp.ast;
7   
8   public class ASTElement extends AbstractJspNode {
9   
10  /* BEGIN CUSTOM CODE */
11  
12      /**
13       * Name of the element-tag. Cannot be null.
14       */
15      private String name;
16  
17      /**
18       * Flag indicating that the element consists of one tag ("<... />").
19       */
20      private boolean empty; //
21      
22      /**
23       * Flag indicating that the parser did not find a proper ending marker 
24       * or ending tag for this element
25       */
26      private boolean unclosed;
27  
28  	/**
29       * @return boolean - true if the element has a namespace-prefix, false otherwise
30       */
31      public boolean isHasNamespacePrefix() {
32          return name.indexOf(':') >= 0;
33      }
34  
35      /**
36       * @return String - the part of the name that is before the (first) colon (":")
37       */
38      public String getNamespacePrefix() {
39          int colonIndex = name.indexOf(':');
40          return colonIndex >= 0
41                  ? name.substring(0, colonIndex)
42                  : "";
43      }
44  
45      /**
46       * @return String - The part of the name that is after the first colon (":").
47       *         If the name does not contain a colon, the full name is returned.
48       */
49      public String getLocalName() {
50          int colonIndex = name.indexOf(':');
51          return colonIndex >= 0
52                  ? name.substring(colonIndex + 1)
53                  : name;
54      }
55  
56      /**
57       * @return Returns the name.
58       */
59      public String getName() {
60          return name;
61      }
62  
63      /**
64       * @param name The name to set.
65       */
66      public void setName(String name) {
67          this.name = name;
68      }
69  
70      /**
71       * @return Returns the empty.
72       */
73      public boolean isEmpty() {
74          return empty;
75      }
76  
77      public boolean isUnclosed() {
78  		return unclosed;
79  	}
80  
81  	public void setUnclosed(boolean unclosed) {
82  		this.unclosed = unclosed;
83  	}
84  
85      /**
86       * @param empty The empty to set.
87       */
88      public void setEmpty(boolean empty) {
89          this.empty = empty;
90      }
91  /* END CUSTOM CODE */
92  
93  
94  
95      public ASTElement(int id) {
96          super(id);
97      }
98  
99      public ASTElement(JspParser p, int id) {
100         super(p, id);
101     }
102 
103 
104     /**
105      * Accept the visitor. *
106      */
107     public Object jjtAccept(JspParserVisitor visitor, Object data) {
108         return visitor.visit(this, data);
109     }
110 }