com.google.javascript.jscomp.jsonml
Class Validator

java.lang.Object
  extended by com.google.javascript.jscomp.jsonml.Validator

public class Validator
extends Object

Statically validates JsonML elements. It is done in constant time: no subtree is traversed, but the element is validated based only on its properties. Sometimes, also its children are taken into account. Usually it checks if the specified element has a correct number of children, and if all require attributes exist. It does not enforce all restrictions which are implied by ES3 or ES5 specification.


Field Summary
static TagType[] exprTypes
           
static String MISSING_ARGUMENT
           
static String NOT_ENOUGH_CHILDREN_FMT
           
static String TOO_MANY_CHILDREN_FMT
           
static String WRONG_CHILD_TYPE_FMT
           
 
Method Summary
static String printList(Object[] list)
           
static String validate(JsonML element)
          Validates the specified JsonML element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MISSING_ARGUMENT

public static final String MISSING_ARGUMENT
See Also:
Constant Field Values

NOT_ENOUGH_CHILDREN_FMT

public static final String NOT_ENOUGH_CHILDREN_FMT
See Also:
Constant Field Values

TOO_MANY_CHILDREN_FMT

public static final String TOO_MANY_CHILDREN_FMT
See Also:
Constant Field Values

WRONG_CHILD_TYPE_FMT

public static final String WRONG_CHILD_TYPE_FMT
See Also:
Constant Field Values

exprTypes

public static TagType[] exprTypes
Method Detail

validate

public static String validate(JsonML element)
Validates the specified JsonML element.

Parameters:
element - JsonML element to validate
Returns:
error message if the element could not be validated, an empty string otherwise

printList

public static String printList(Object[] list)