org.eclipse.jet.taglib
Class TagInfo

java.lang.Object
  extended by org.eclipse.jet.taglib.TagInfo

public final class TagInfo
extends java.lang.Object

Define contextual information for a custom tag. The class is immutable. The Tag context is the mechanism by which custom tag code accesses the tag parameters code in a template.

Contextual information includes:

  • the tag location in the source template (line # and start, end offsets)
  • the raw attribute values as specified in template.

    This class is instantiated in the compiled JET2 template. Clients would not normally instantiate instances of this class.


    Constructor Summary
    TagInfo(java.lang.String tagName, int line, int start, int end, java.lang.String[] attrNames, java.lang.String[] attrValues)
              Deprecated. Use TagInfo(String, int, int, String[], String[]) instead.
    TagInfo(java.lang.String tagName, int line, int col, java.lang.String[] attrNames, java.lang.String[] attrValues)
               
     
    Method Summary
     java.lang.String getAttribute(java.lang.String name)
              Return the value of an attribute.
     java.lang.String[] getAttributeNames()
              Return an array of attribute names
     int getCol()
              Return the one-based column number of the start of the tag withing the tag's start line.
     int getLine()
              Return the one-based line number of the start of the tag.
     java.lang.String getTagName()
              Return the tag name, as specified in the input, complete with namespace prefix.
     boolean hasAttribute(java.lang.String name)
              Test whether an attribute value was set.
     java.lang.String toString()
               
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
     

    Constructor Detail

    TagInfo

    public TagInfo(java.lang.String tagName,
                   int line,
                   int col,
                   java.lang.String[] attrNames,
                   java.lang.String[] attrValues)

    TagInfo

    public TagInfo(java.lang.String tagName,
                   int line,
                   int start,
                   int end,
                   java.lang.String[] attrNames,
                   java.lang.String[] attrValues)
    Deprecated. Use TagInfo(String, int, int, String[], String[]) instead.

    Construct a TagInfo

    Parameters:
    tagName -
    line -
    start -
    end -
    attrNames -
    attrValues -
    Method Detail

    getLine

    public final int getLine()
    Return the one-based line number of the start of the tag.

    Returns:
    Returns the line.

    getAttribute

    public final java.lang.String getAttribute(java.lang.String name)
    Return the value of an attribute.

    Parameters:
    name - the attribute name. Cannot be null.
    Returns:
    the attribute value, or null if the attribute was not set on the tag.
    Throws:
    java.lang.NullPointerException - if name is null.

    hasAttribute

    public final boolean hasAttribute(java.lang.String name)
    Test whether an attribute value was set.

    Parameters:
    name - the attribute name. Cannot be null.
    Returns:
    true if the attribute was set, false otherwise.
    Throws:
    java.lang.NullPointerException - if name is null.

    toString

    public java.lang.String toString()
    Overrides:
    toString in class java.lang.Object

    getTagName

    public final java.lang.String getTagName()
    Return the tag name, as specified in the input, complete with namespace prefix.

    Returns:
    Returns the tagName.

    getAttributeNames

    public final java.lang.String[] getAttributeNames()
    Return an array of attribute names

    Returns:
    an possibly empty array of String values.

    getCol

    public final int getCol()
    Return the one-based column number of the start of the tag withing the tag's start line.

    Returns:
    Returns the col.

    Copyright 2006 IBM Corporation and others.
    All Rights Reserved.