TemplateElement

public class TemplateElement

A TemplateElement represents a composing element of a template. There are two types of template elements:

  1. Text
  2. Template Tag
Author:Hugo Y. K. Lam

See also: Template

Constructors

TemplateElement

public TemplateElement(String name)

Creates a new instance of TemplateElement which represents a template tag element.

Parameters:
  • name – the element name.

TemplateElement

public TemplateElement(String s, boolean isText)

Creates a new instance of TemplateElement.

Parameters:
  • s – the element name or text if it is a text element.
  • isText – true if this element is a text element.

Methods

getName

public String getName()

Gets the element name.

Returns:the element name or null if it is a text element.

getText

public String getText()

Gets the text of this element.

Returns:the text of this element or null if it is a template tag element.

isText

public boolean isText()

Checks if this element is a text element.

Returns:true if this element is a text element.

toString

public String toString()

Returns a string representation of this element.

Returns:the text of this element if it is a text element or the element name otherwise.

See also: java.lang.Object.toString()