@Override public void generateDecorator(final Decorable decorable, final FactoryController controller) { final ShadowService shadowService = (ShadowService) decorable.getAnnotation(); String serviceName = null; Statement subscribeShadowStatement = null; final Class<?> javaClass = decorable.getType().asClass(); for (final Class<?> intf : javaClass.getInterfaces()) { if (intf.isAnnotationPresent(Remote.class)) { serviceName = intf.getName() + ":RPC"; final AnonymousClassStructureBuilder builder = generateMethodDelegates(intf, decorable, controller); subscribeShadowStatement = Stmt.castTo(ClientMessageBus.class, Stmt.invokeStatic(ErraiBus.class, "get")) .invoke("subscribeShadow", serviceName, builder.finish()); } if (serviceName == null) { if (shadowService.value().equals("")) { serviceName = decorable.getName(); } else { serviceName = shadowService.value(); } subscribeShadowStatement = Stmt.castTo(ClientMessageBus.class, Stmt.invokeStatic(ErraiBus.class, "get")) .invoke("subscribeShadow", serviceName, controller.contextGetInstanceStmt()); } controller.addFactoryInitializationStatements(Collections.singletonList(subscribeShadowStatement)); } }
@Override public void generateDecorator(final Decorable decorable, final FactoryController controller) { final ShadowService shadowService = (ShadowService) decorable.getAnnotation(); String serviceName = null; Statement subscribeShadowStatement = null; final Class<?> javaClass = decorable.getType().asClass(); for (final Class<?> intf : javaClass.getInterfaces()) { if (intf.isAnnotationPresent(Remote.class)) { serviceName = intf.getName() + ":RPC"; final AnonymousClassStructureBuilder builder = generateMethodDelegates(intf, decorable, controller); subscribeShadowStatement = Stmt.castTo(ClientMessageBus.class, Stmt.invokeStatic(ErraiBus.class, "get")) .invoke("subscribeShadow", serviceName, builder.finish()); } if (serviceName == null) { if (shadowService.value().equals("")) { serviceName = decorable.getName(); } else { serviceName = shadowService.value(); } subscribeShadowStatement = Stmt.castTo(ClientMessageBus.class, Stmt.invokeStatic(ErraiBus.class, "get")) .invoke("subscribeShadow", serviceName, controller.contextGetInstanceStmt()); } controller.addFactoryInitializationStatements(Collections.singletonList(subscribeShadowStatement)); } }
final String registrationHandleVar = "handleFor" + decorable.getName(); final List<Statement> bindExecStmts = new ArrayList<Statement>(); final boolean enclosingTypeIsDependent = decorable.isEnclosingTypeDependent();
final String registrationHandleVar = "handleFor" + decorable.getName(); final List<Statement> bindExecStmts = new ArrayList<Statement>(); final boolean enclosingTypeIsDependent = decorable.isEnclosingTypeDependent();
String property = propertyIsEmpty ? decorable.getName() : bound.property(); if (!DataBindingValidator.isValidPropertyChain(binderLookup.getDataModelType(), property)) { if (propertyIsEmpty && binderLookup.getDataModelType().equals(getValueType(decorable.getType()))) { throw new GenerationException("Invalid binding of field " + decorable.getName() + " in class " + targetClass + "! Property " + property + " not resolvable from class " + binderLookup.getDataModelType() || componentType.isAssignableTo(org.jboss.errai.common.client.api.elemental2.IsElement.class) || componentType.isAssignableTo(IsElement.class))) { throw new GenerationException("@Bound field or method " + decorable.getName() + " in class " + targetClass + " must be assignable to Widget, TakesValue, or a DOM element type but provides: " + decorable.getName() + " in class " + targetClass);
String property = propertyIsEmpty ? decorable.getName() : bound.property(); if (!DataBindingValidator.isValidPropertyChain(binderLookup.getDataModelType(), property)) { if (propertyIsEmpty && binderLookup.getDataModelType().equals(getValueType(decorable.getType()))) { throw new GenerationException("Invalid binding of field " + decorable.getName() + " in class " + targetClass + "! Property " + property + " not resolvable from class " + binderLookup.getDataModelType() || componentType.isAssignableTo(org.jboss.errai.common.client.api.elemental2.IsElement.class) || componentType.isAssignableTo(IsElement.class))) { throw new GenerationException("@Bound field or method " + decorable.getName() + " in class " + targetClass + " must be assignable to Widget, TakesValue, or a DOM element type but provides: " + decorable.getName() + " in class " + targetClass);
controller.ensureMemberExposed(decorable.get()); Statement instance = decorable.getAccessStatement(); final String name = getTemplateDataFieldName((DataField) decorable.getAnnotation(), decorable.getName()); final boolean isWidget = decorable.getType().isAssignableTo(Widget.class); if (!isWidget && decorable.getType().isAnnotationPresent(Templated.class)) { saveDataField(decorable, decorable.getType(), name, decorable.getName(), instance);
controller.ensureMemberExposed(decorable.get()); Statement instance = decorable.getAccessStatement(); final String name = getTemplateDataFieldName((DataField) decorable.getAnnotation(), decorable.getName()); final boolean isWidget = decorable.getType().isAssignableTo(Widget.class); if (!isWidget && decorable.getType().isAnnotationPresent(Templated.class)) { saveDataField(decorable, decorable.getType(), name, decorable.getName(), instance);