com.primix.tapestry.parse
Class TemplateToken

java.lang.Object
  |
  +--com.primix.tapestry.parse.TemplateToken

public class TemplateToken
extends java.lang.Object

A token parsed from a Tapestry HTML template.

TBD: Use a single token to represent an bodyless component.

Version:
$Id: TemplateToken.java,v 1.7 2001/07/03 13:55:10 hship Exp $
Author:
Howard Ship

Constructor Summary
TemplateToken(char[] templateData, int startIndex, int endIndex)
          Constructs a TEXT token with the given template data.
TemplateToken(java.lang.String id, java.lang.String tag)
          Constructs an OPEN token with the given id.
TemplateToken(java.lang.String id, java.lang.String tag, java.util.Map attributes)
          Contructs and OPEN token with the given id and attributes.
TemplateToken(TokenType type, java.lang.String tag)
          Constructs token, typically used with CLOSE.
 
Method Summary
 java.util.Map getAttributes()
          Returns the attributes associated with an OPEN tag, which may be null.
 int getEndIndex()
           
 java.lang.String getId()
          Returns the id of the component.
 IRender getRender()
           
 int getStartIndex()
          Returns the starting index of the token.
 java.lang.String getTag()
          Returns the tag (for an OPEN or CLOSE) token.
 TokenType getType()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TemplateToken

public TemplateToken(char[] templateData,
                     int startIndex,
                     int endIndex)
Constructs a TEXT token with the given template data.

TemplateToken

public TemplateToken(TokenType type,
                     java.lang.String tag)
Constructs token, typically used with CLOSE.

TemplateToken

public TemplateToken(java.lang.String id,
                     java.lang.String tag)
Constructs an OPEN token with the given id.

TemplateToken

public TemplateToken(java.lang.String id,
                     java.lang.String tag,
                     java.util.Map attributes)
Contructs and OPEN token with the given id and attributes.
Since:
1.0.2
Method Detail

getEndIndex

public int getEndIndex()

getId

public java.lang.String getId()
Returns the id of the component. This is only valid when the type is OPEN.

getTag

public java.lang.String getTag()
Returns the tag (for an OPEN or CLOSE) token.
Since:
1.0.2

getRender

public IRender getRender()

getStartIndex

public int getStartIndex()
Returns the starting index of the token. Will return -1 for any non-TEXT token.

getType

public TokenType getType()

getAttributes

public java.util.Map getAttributes()
Returns the attributes associated with an OPEN tag, which may be null.
Since:
1.0.2

toString

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