com.google.streamhtmlparser
Class ExternalState

java.lang.Object
  extended by com.google.streamhtmlparser.ExternalState

public class ExternalState
extends Object

A representation of the parser state suitable for use by the caller of the Parser. The meaning of each state and therefore which action the caller should perform on that state is not self-evident. In particular, it depends on which parser is used (currently HtmlParser and JavascriptParser). For examples, you will have to look at the Google Template System and ClearSilver both of which support Auto-Escaping by interfacing with our parser (using the parser written in C++).

The caller of the Parser will query for the current parser state at points of interest during parsing of templates. Based on the parser's current state as represented by this class, the caller can determine the appropriate escaping to apply.

Note: Given this class is external-facing, I considered creating an interface but it is not likely we'll ever need to add more flexibility and the class is so simple, I figured it was not warranted.

See Also:
HtmlParser, JavascriptParser

Constructor Summary
ExternalState(String name)
          Creates an ExternalState object.
 
Method Summary
 String getName()
          Returns the name of the object.
 String toString()
          Returns the string representation of this external state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExternalState

public ExternalState(String name)
Creates an ExternalState object.

Parameters:
name - the name to assign to that state
See Also:
HtmlParser, JavascriptParser
Method Detail

getName

public String getName()
Returns the name of the object. The name is only needed to provide human-readable information when debugging.

Returns:
the name of that object

toString

public String toString()
Returns the string representation of this external state. The details of this representation are subject to change.

Overrides:
toString in class Object


Copyright © 2010-2012 Google. All Rights Reserved.