@Override public String toString() { return getMessage(); }
public static GeneratorMappingContext getFor(GeneratorContext context, MarshallerOutputTarget target) { GeneratorMappingContext mappingContext = null; if (target == MarshallerOutputTarget.GWT) { mappingContext = gwtContexts.get(context); } else if (target == MarshallerOutputTarget.Java) { mappingContext = javaContext; } if (mappingContext == null) { throw new GenerationException("Generation context for output target " + target + " was not created!"); } return mappingContext; }
protected void blameAndRethrow(GenerationException e) { if (!blameDetailsEnabled) { final RuntimeException blamePlaceHolder = new RuntimeException( "Problem during Errai code generation. Please set system property -Derrai.codegen.details=true for more details."); blamePlaceHolder.initCause(e); throw blamePlaceHolder; } if (e.getCause() == null) { GenUtil.rewriteBlameStackTrace(blame); e.initCause(blame); } throw e; } }
@Override public void assertCanBeApplied(MetaClass clazz) { if (!canBeApplied(clazz)) { throw new InvalidExpressionException("Not a valid type for operator '" + canonicalString + "': " + clazz.getFullyQualifiedName()); } }
private MetaClass inferType(final Context context, final Object initialization) { final Statement initStatement = GenUtil.generate(context, initialization); final MetaClass inferredType = (initStatement != null) ? initStatement.getType() : null; if (inferredType == null) { throw new InvalidTypeException("No type specified and no initialization provided to infer the type."); } return inferredType; }
public static GeneratorMappingContext getFor(GeneratorContext context, MarshallerOutputTarget target) { GeneratorMappingContext mappingContext = null; if (target == MarshallerOutputTarget.GWT) { mappingContext = gwtContexts.get(context); } else if (target == MarshallerOutputTarget.Java) { mappingContext = javaContext; } if (mappingContext == null) { throw new GenerationException("Generation context for output target " + target + " was not created!"); } return mappingContext; }
@Override public String toString() { return getMessage(); }
@Override public void assertCanBeApplied(MetaClass clazz) { if (!canBeApplied(clazz)) { throw new InvalidExpressionException("Not a valid type for operator '" + canonicalString + "': " + clazz.getFullyQualifiedName()); } }
private MetaClass inferType(final Context context, final Object initialization) { final Statement initStatement = GenUtil.generate(context, initialization); final MetaClass inferredType = (initStatement != null) ? initStatement.getType() : null; if (inferredType == null) { throw new InvalidTypeException("No type specified and no initialization provided to infer the type."); } return inferredType; }
public static GeneratorMappingContext getFor(GeneratorContext context, MarshallerOutputTarget target) { GeneratorMappingContext mappingContext = null; if (target == MarshallerOutputTarget.GWT) { mappingContext = gwtContexts.get(context); } else if (target == MarshallerOutputTarget.Java) { mappingContext = javaContext; } if (mappingContext == null) { throw new GenerationException("Generation context for output target " + target + " was not created!"); } return mappingContext; }
private void validateDefaultPagePresent(Collection<MetaClass> pages, Multimap<Class<?>, MetaClass> pageRoles) { Collection<MetaClass> defaultPages = pageRoles.get(DefaultPage.class); if (!pages.isEmpty() && defaultPages.isEmpty()) { throw new GenerationException( "No @Page classes have role = DefaultPage. Exactly one @Page class" + " must be designated as the default starting page."); } }
private void validateDefaultPagePresent(Collection<MetaClass> pages, Multimap<Class<?>, MetaClass> pageRoles) { Collection<MetaClass> defaultPages = pageRoles.get(DefaultPage.class); if (!pages.isEmpty() && defaultPages.isEmpty()) { throw new GenerationException( "No @Page classes have role = DefaultPage. Exactly one @Page class" + " must be designated as the default starting page."); } }
private void createValidationError(Collection<MetaClass> pages, Class<?> role) { StringBuilder builder = new StringBuilder(); for (MetaClass mc : pages) { builder.append("\n ").append(mc.getFullyQualifiedName()); } throw new GenerationException( "Found more than one @Page with role = '" + role + "': " + builder + "\nExactly one @Page class must be designated with this unique role."); }
private void createValidationError(Collection<MetaClass> pages, Class<?> role) { StringBuilder builder = new StringBuilder(); for (MetaClass mc : pages) { builder.append("\n ").append(mc.getFullyQualifiedName()); } throw new GenerationException( "Found more than one @Page with role = '" + role + "': " + builder + "\nExactly one @Page class must be designated with this unique role."); }
private void validateSafePagePath(Collection<MetaClass> pages) { for (final MetaClass page : pages) { String pageName = getPageName(page); String path = getPageURL(page, pageName); if (!path.equals(pageName)) { if (path.contains(";") || path.contains("=") || path.contains("&")) { throw new GenerationException("Invalid page path for page " + pageName + ". Page paths must not contain " + "semicolons(;), ampersands(&) or equal signs(=)."); } } } }
private void validateSafePagePath(Collection<MetaClass> pages) { for (final MetaClass page : pages) { String pageName = getPageName(page); String path = getPageURL(page, pageName); if (!path.equals(pageName)) { if (path.contains(";") || path.contains("=") || path.contains("&")) { throw new GenerationException("Invalid page path for page " + pageName + ". Page paths must not contain " + "semicolons(;), ampersands(&) or equal signs(=)."); } } } }
private void validateNonEmptyEventHandlerTargets(final MetaClass declaringClass, final MetaMethod method, final String[] targetDataFieldNames) { if (targetDataFieldNames.length == 0) { throw new GenerationException("@EventHandler annotation on method [" + declaringClass.getFullyQualifiedName() + "." + method.getName() + "] must specify at least one data-field target."); } }
/** * Ensured the provided type is bindable and throws a * {@link GenerationException} in case it's not. * * @param type * the type to check */ private static void assertTypeIsBindable(final MetaClass type) { if (!isBindableType(type)) { throw new GenerationException(type.getName() + " must be a @Bindable type when used as @Model"); } }
/** * Ensured the provided type is bindable and throws a * {@link GenerationException} in case it's not. * * @param type * the type to check */ private static void assertTypeIsBindable(final MetaClass type) { if (!isBindableType(type)) { throw new GenerationException(type.getName() + " must be a @Bindable type when used as @Model"); } }
private void validateNonEmptyEventHandlerTargets(final MetaClass declaringClass, final MetaMethod method, final String[] targetDataFieldNames) { if (targetDataFieldNames.length == 0) { throw new GenerationException("@EventHandler annotation on method [" + declaringClass.getFullyQualifiedName() + "." + method.getName() + "] must specify at least one data-field target."); } }