if (!writer.isElementAssignableTo(toAdd, paramClass)) { writer.die(child, "Expected child of type %s in %s, found %s", paramClass.getSimpleSourceName(), child, toAdd);
public boolean isWidgetElement(XMLElement elem) throws UnableToCompleteException { return isElementAssignableTo(elem, IsWidget.class); }
public boolean isWidgetElement(XMLElement elem) throws UnableToCompleteException { return isElementAssignableTo(elem, IsWidget.class); }
public boolean isWidgetElement(XMLElement elem) throws UnableToCompleteException { return isElementAssignableTo(elem, IsWidget.class); }
public boolean isWidgetElement(XMLElement elem) throws UnableToCompleteException { return isElementAssignableTo(elem, IsWidget.class); }
public String interpretElement(XMLElement elem) throws UnableToCompleteException { if (writer.useLazyWidgetBuilders() && writer.isElementAssignableTo(elem, SafeHtml.class)) { FieldWriter childField = writer.parseElementToField(elem); return writer.tokenForSafeHtmlExpression(elem, childField.getNextReference()); } if (writer.isImportedElement(elem)) { writer.die(elem, "Not allowed in an HTML context"); } if (elem.getNamespaceUri() != null && !writer.isBinderElement(elem)) { // It's not a widget, and it's not a ui: element. writer.die(elem, "Prefix \"%s:\" has unrecognized xmlns \"%s\" (bad import?)", elem.getPrefix(), elem.getNamespaceUri()); } return pipe.interpretElement(elem); } }
public boolean isElementAssignableTo(XMLElement elem, JClassType possibleSupertype) throws UnableToCompleteException { /* * Things like <W extends IsWidget & IsPlaid> */ JTypeParameter typeParameter = possibleSupertype.isTypeParameter(); if (typeParameter != null) { JClassType[] bounds = typeParameter.getBounds(); for (JClassType bound : bounds) { if (!isElementAssignableTo(elem, bound)) { return false; } } return true; } /* * Binder fields are always declared raw, so we're cheating if the user is * playing with parameterized types. We're happy enough if the raw types * match, and rely on them to make sure the specific types really do work. */ JParameterizedType parameterized = possibleSupertype.isParameterized(); if (parameterized != null) { return isElementAssignableTo(elem, parameterized.getRawType()); } JClassType fieldtype = findFieldType(elem); if (fieldtype == null) { return false; } return fieldtype.isAssignableTo(possibleSupertype); }
public boolean isElementAssignableTo(XMLElement elem, JClassType possibleSupertype) throws UnableToCompleteException { /* * Things like <W extends IsWidget & IsPlaid> */ JTypeParameter typeParameter = possibleSupertype.isTypeParameter(); if (typeParameter != null) { JClassType[] bounds = typeParameter.getBounds(); for (JClassType bound : bounds) { if (!isElementAssignableTo(elem, bound)) { return false; } } return true; } /* * Binder fields are always declared raw, so we're cheating if the user is * playing with parameterized types. We're happy enough if the raw types * match, and rely on them to make sure the specific types really do work. */ JParameterizedType parameterized = possibleSupertype.isParameterized(); if (parameterized != null) { return isElementAssignableTo(elem, parameterized.getRawType()); } JClassType fieldtype = findFieldType(elem); if (fieldtype == null) { return false; } return fieldtype.isAssignableTo(possibleSupertype); }
public boolean isElementAssignableTo(XMLElement elem, JClassType possibleSupertype) throws UnableToCompleteException { /* * Things like <W extends IsWidget & IsPlaid> */ JTypeParameter typeParameter = possibleSupertype.isTypeParameter(); if (typeParameter != null) { JClassType[] bounds = typeParameter.getBounds(); for (JClassType bound : bounds) { if (!isElementAssignableTo(elem, bound)) { return false; } } return true; } /* * Binder fields are always declared raw, so we're cheating if the user is * playing with parameterized types. We're happy enough if the raw types * match, and rely on them to make sure the specific types really do work. */ JParameterizedType parameterized = possibleSupertype.isParameterized(); if (parameterized != null) { return isElementAssignableTo(elem, parameterized.getRawType()); } JClassType fieldtype = findFieldType(elem); if (fieldtype == null) { return false; } return fieldtype.isAssignableTo(possibleSupertype); }
public boolean isElementAssignableTo(XMLElement elem, JClassType possibleSupertype) throws UnableToCompleteException { /* * Things like <W extends IsWidget & IsPlaid> */ JTypeParameter typeParameter = possibleSupertype.isTypeParameter(); if (typeParameter != null) { JClassType[] bounds = typeParameter.getBounds(); for (JClassType bound : bounds) { if (!isElementAssignableTo(elem, bound)) { return false; } } return true; } /* * Binder fields are always declared raw, so we're cheating if the user is * playing with parameterized types. We're happy enough if the raw types * match, and rely on them to make sure the specific types really do work. */ JParameterizedType parameterized = possibleSupertype.isParameterized(); if (parameterized != null) { return isElementAssignableTo(elem, parameterized.getRawType()); } JClassType fieldtype = findFieldType(elem); if (fieldtype == null) { return false; } return fieldtype.isAssignableTo(possibleSupertype); }
if (!writer.isElementAssignableTo(toAdd, paramClass)) { writer.die(child, "Expected child of type %s in %s, found %s", paramClass.getSimpleSourceName(), child, toAdd);
if (!writer.isElementAssignableTo(toAdd, paramClass)) { writer.die(child, "Expected child of type %s in %s, found %s", paramClass.getSimpleSourceName(), child, toAdd);
public String interpretElement(XMLElement elem) throws UnableToCompleteException { if (writer.useLazyWidgetBuilders() && writer.isElementAssignableTo(elem, SafeHtml.class)) { FieldWriter childField = writer.parseElementToField(elem); return writer.tokenForSafeHtmlExpression(elem, childField.getNextReference()); } if (writer.isImportedElement(elem)) { writer.die(elem, "Not allowed in an HTML context"); } if (elem.getNamespaceUri() != null && !writer.isBinderElement(elem)) { // It's not a widget, and it's not a ui: element. writer.die(elem, "Prefix \"%s:\" has unrecognized xmlns \"%s\" (bad import?)", elem.getPrefix(), elem.getNamespaceUri()); } return pipe.interpretElement(elem); } }
public String interpretElement(XMLElement elem) throws UnableToCompleteException { if (writer.useLazyWidgetBuilders() && writer.isElementAssignableTo(elem, SafeHtml.class)) { FieldWriter childField = writer.parseElementToField(elem); return writer.tokenForSafeHtmlExpression(elem, childField.getNextReference()); } if (writer.isImportedElement(elem)) { writer.die(elem, "Not allowed in an HTML context"); } if (elem.getNamespaceUri() != null && !writer.isBinderElement(elem)) { // It's not a widget, and it's not a ui: element. writer.die(elem, "Prefix \"%s:\" has unrecognized xmlns \"%s\" (bad import?)", elem.getPrefix(), elem.getNamespaceUri()); } return pipe.interpretElement(elem); } }