public class FieldReferenceConverter extends Object
<div
class="{style.enabled} fancy {style.impressive}" />
, by converting
them to java expressions (with the help of a
Delegate
).
A field reference is one or more segments separated by dots. The first
segment is considered to be a reference to a ui field, and succeeding
segments are method calls. So, "{able.baker.charlie}"
becomes
"able.baker().charlie()"
.
A field reference starts with '{' and is followed immediately by a character that can legally start a java identifier—that is a letter, $, or underscore. Braces not followed by such a character are left in place.
For convenience when dealing with generated CssResources, field segments with dashes are converted to camel case. That is, {able.baker-charlie} is the same as {able.bakerCharlie}
Double mustaches (i.e. "{{..}}") are not matched as references to play well with modern templating systems.
Opening braces may be escape by slash. That is, "\{foo}" will converted to "{foo}", with no field reference detected.
Modifier and Type | Class and Description |
---|---|
static class |
FieldReferenceConverter.IllegalFieldReferenceException
May be thrown by the
Delegate for badly formatted input. |
Modifier and Type | Method and Description |
---|---|
String |
convert(String in,
com.google.gwt.uibinder.attributeparsers.FieldReferenceConverter.Delegate delegate) |
String |
convert(com.google.gwt.uibinder.rebind.XMLElement source,
String in,
com.google.gwt.uibinder.attributeparsers.FieldReferenceConverter.Delegate delegate) |
static int |
countFieldReferences(String string)
Returns the number of field references in the given string.
|
static String |
expressionToPath(String expression)
Reverses most of the work of
convert(java.lang.String, com.google.gwt.uibinder.attributeparsers.FieldReferenceConverter.Delegate) , turning a java expression
back into a dotted path. |
static boolean |
hasFieldReferences(String string)
Returns true if the given string holds one or more field references.
|
public static int countFieldReferences(String string)
public static String expressionToPath(String expression)
convert(java.lang.String, com.google.gwt.uibinder.attributeparsers.FieldReferenceConverter.Delegate)
, turning a java expression
back into a dotted path.public static boolean hasFieldReferences(String string)
public String convert(String in, com.google.gwt.uibinder.attributeparsers.FieldReferenceConverter.Delegate delegate)
FieldReferenceConverter.IllegalFieldReferenceException
- if the delegate doespublic String convert(com.google.gwt.uibinder.rebind.XMLElement source, String in, com.google.gwt.uibinder.attributeparsers.FieldReferenceConverter.Delegate delegate)
FieldReferenceConverter.IllegalFieldReferenceException
- if the delegate doesCopyright © 2018. All rights reserved.