GWT 2.7.0

com.google.gwt.uibinder.attributeparsers
Class SafeUriAttributeParser

java.lang.Object
  extended by com.google.gwt.uibinder.attributeparsers.StrictAttributeParser
      extended by com.google.gwt.uibinder.attributeparsers.SafeUriAttributeParser
All Implemented Interfaces:
AttributeParser

public class SafeUriAttributeParser
extends StrictAttributeParser

Parses SafeUri literals or references.

Simple String literals are passed through UriUtils.fromConstantString(String)

Accepts concatenated string expressions, mainly for compatibility with legacy <a href="{foo.bar}{baz.bang}"> abuses. Passes such nonsense through UriUtils.fromString(String)


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.uibinder.attributeparsers.StrictAttributeParser
StrictAttributeParser.FieldReferenceDelegate
 
Field Summary
 
Fields inherited from class com.google.gwt.uibinder.attributeparsers.StrictAttributeParser
logger
 
Constructor Summary
SafeUriAttributeParser(StringAttributeParser stringParser, FieldReferenceConverter converter, JType safeUriType, JType stringType, com.google.gwt.uibinder.rebind.MortalLogger logger)
          Constructs an instance for particular use in html contexts, where {string.references} are acceptible.
SafeUriAttributeParser(StringAttributeParser stringParser, FieldReferenceConverter converter, JType safeUriType, com.google.gwt.uibinder.rebind.MortalLogger logger)
          Constructs an instance for normal use, where String literals are okay but {string.references} are not.
 
Method Summary
 java.lang.String parse(com.google.gwt.uibinder.rebind.XMLElement source, java.lang.String value)
          If the value holds a single field reference "{like.this}", converts it to a Java Expression.
static java.lang.String wrapUnsafeStringAndWarn(com.google.gwt.uibinder.rebind.MortalLogger logger, com.google.gwt.uibinder.rebind.XMLElement source, java.lang.String expression)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SafeUriAttributeParser

SafeUriAttributeParser(StringAttributeParser stringParser,
                       FieldReferenceConverter converter,
                       JType safeUriType,
                       JType stringType,
                       com.google.gwt.uibinder.rebind.MortalLogger logger)
Constructs an instance for particular use in html contexts, where {string.references} are acceptible.


SafeUriAttributeParser

SafeUriAttributeParser(StringAttributeParser stringParser,
                       FieldReferenceConverter converter,
                       JType safeUriType,
                       com.google.gwt.uibinder.rebind.MortalLogger logger)
Constructs an instance for normal use, where String literals are okay but {string.references} are not.

Method Detail

wrapUnsafeStringAndWarn

public static java.lang.String wrapUnsafeStringAndWarn(com.google.gwt.uibinder.rebind.MortalLogger logger,
                                                       com.google.gwt.uibinder.rebind.XMLElement source,
                                                       java.lang.String expression)

parse

public java.lang.String parse(com.google.gwt.uibinder.rebind.XMLElement source,
                              java.lang.String value)
                       throws UnableToCompleteException
Description copied from class: StrictAttributeParser
If the value holds a single field reference "{like.this}", converts it to a Java Expression.

In any other case (e.g. more than one field reference), an UnableToCompleteException is thrown.

Specified by:
parse in interface AttributeParser
Overrides:
parse in class StrictAttributeParser
Parameters:
source - the source code the value came from, for error reporting purposes
value - the attribute value to be parsed
Returns:
a valid Java expression
Throws:
UnableToCompleteException - on parse error

GWT 2.7.0