View Javadoc

    1   /* Generated By:JJTree: Do not edit this line. ASTAttribute.java */
    2
    3   package net.sourceforge.pmd.jsp.ast;
    4
    5   public class ASTAttribute extends SimpleNode {
    6       /* BEGIN CUSTOM CODE */
    7       private String name;
    8
    9       /***
    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      /***
    25       * @return boolean - true if the element has a namespace-prefix, false otherwise
    26       */
    27      public boolean isHasNamespacePrefix() {
    28          return (name.indexOf(':') >= 0);
    29      }
    30
    31      /***
    32       * @return String - the part of the name that is before the (first) colon (":")
    33       */
    34      public String getNamespacePrefix() {
    35          int colonIndex = name.indexOf(':');
    36          return ((colonIndex >= 0)
    37                  ? name.substring(0, colonIndex)
    38                  : "");
    39      }
    40
    41      /***
    42       * @return String - The part of the name that is after the first colon (":").
    43       *         If the name does not contain a colon, the full name is returned.
    44       */
    45      public String getLocalName() {
    46          int colonIndex = name.indexOf(':');
    47          return ((colonIndex >= 0)
    48                  ? name.substring(colonIndex + 1)
    49                  : name);
    50      }
    51
    52      /* (non-Javadoc)
    53       * @see com.applicationengineers.pmd4jsp.ast.SimpleNode#toString(java.lang.String)
    54       */
    55      public String toString(String prefix) {
    56          return super.toString(prefix) + " name=[" + name + "]";
    57      }
    58
    59  /* END CUSTOM CODE */
    60
    61
    62      public ASTAttribute(int id) {
    63          super(id);
    64      }
    65
    66      public ASTAttribute(JspParser p, int id) {
    67          super(p, id);
    68      }
    69
    70
    71      /***
    72       * Accept the visitor. *
    73       */
    74      public Object jjtAccept(JspParserVisitor visitor, Object data) {
    75          return visitor.visit(this, data);
    76      }
    77  }