private void saveDataField(final Decorable decorable, final MetaClass type, final String name, final String fieldName, final Statement instance) { dataFieldMap(decorable.getInjectionContext(), decorable.getDecorableDeclaringType()).put(name, instance); dataFieldTypeMap(decorable.getInjectionContext(), decorable.getDecorableDeclaringType()).put(name, type); dataFieldAnnotationMap(decorable.getInjectionContext(), decorable.getDecorableDeclaringType()).put(name, (DataField) decorable.getAnnotation()); }
private void saveDataField(final Decorable decorable, final MetaClass type, final String name, final String fieldName, final Statement instance) { dataFieldMap(decorable.getInjectionContext(), decorable.getDecorableDeclaringType()).put(name, instance); dataFieldTypeMap(decorable.getInjectionContext(), decorable.getDecorableDeclaringType()).put(name, type); dataFieldAnnotationMap(decorable.getInjectionContext(), decorable.getDecorableDeclaringType()).put(name, (DataField) decorable.getAnnotation()); }
@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) { MetaMethod method = decorable.getAsMethod(); MetaParameter[] params = method.getParameters(); if (params.length != 1 || !params[0].getType().getErased().equals(MetaClassFactory.get(SyncResponses.class))) { throw new GenerationException("Methods annotated with @" + Sync.class.getName() + " need to have exactly one parameter of type: " + SyncResponses.class.getName() + ". Check method: " + GenUtil.getMethodString(method) + " in class " + method.getDeclaringClass().getFullyQualifiedName()); } Sync syncAnnotation = (Sync) decorable.getAnnotation(); controller.addInitializationStatements(createInitStatements(decorable.getDecorableDeclaringType(), "obj", syncAnnotation, decorable, controller)); final Statement syncWorker = controller.getReferenceStmt("syncWorker", ClientSyncWorker.class); final Statement destruction = Stmt.nestedCall(syncWorker).invoke("stop"); controller.addDestructionStatements(Collections.singletonList(destruction)); }
final MetaClass declaringClass = decorable.getDecorableDeclaringType(); final Templated anno = (Templated) decorable.getAnnotation(); final Class<?> templateProvider = anno.provider(); final boolean customProvider = templateProvider != Templated.DEFAULT_PROVIDER.class;
@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) { Service serviceAnno = (Service) decorable.getAnnotation();
final MetaClass declaringClass = decorable.getDecorableDeclaringType(); final Templated anno = (Templated) decorable.getAnnotation(); final Class<?> templateProvider = anno.provider(); final boolean customProvider = templateProvider != Templated.DEFAULT_PROVIDER.class;
@Override public void generateDecorator(final Decorable decorable, final FactoryController controller) { Service serviceAnno = (Service) decorable.getAnnotation();
if (decorable.getAnnotation().annotationType().getPackage().getName().startsWith("org.jboss.errai")) { return; initStmts.add(invokeStatic(StyleBindingsRegistry.class, "get") .invoke("addElementBinding", Refs.get("instance"), decorable.getAnnotation(), nestedCall(valueAccessor).invoke("getElement"))); initStmts.add(invokeStatic(StyleBindingsRegistry.class, "get") .invoke("addElementBinding", Refs.get("instance"), decorable.getAnnotation(), Stmt.invokeStatic(TemplateWidgetMapper.class, "get", valueAccessor).invoke("getElement"))); initStmts.add(invokeStatic(StyleBindingsRegistry.class, "get") .invoke("addElementBinding", Refs.get("instance"), decorable.getAnnotation(), invokeStatic(TemplateUtil.class, "asDeprecatedElement", valueAccessor))); } else { throw new RuntimeException("Unrecognized type, " + decorable.getType().getFullyQualifiedName() + ", with style binding " + decorable.getAnnotation().annotationType().getName());
if (decorable.getAnnotation().annotationType().getPackage().getName().startsWith("org.jboss.errai")) { return; initStmts.add(invokeStatic(StyleBindingsRegistry.class, "get") .invoke("addElementBinding", Refs.get("instance"), decorable.getAnnotation(), nestedCall(valueAccessor).invoke("getElement"))); initStmts.add(invokeStatic(StyleBindingsRegistry.class, "get") .invoke("addElementBinding", Refs.get("instance"), decorable.getAnnotation(), Stmt.invokeStatic(TemplateWidgetMapper.class, "get", valueAccessor).invoke("getElement"))); initStmts.add(invokeStatic(StyleBindingsRegistry.class, "get") .invoke("addElementBinding", Refs.get("instance"), decorable.getAnnotation(), invokeStatic(TemplateUtil.class, "asDeprecatedElement", valueAccessor))); } else { throw new RuntimeException("Unrecognized type, " + decorable.getType().getFullyQualifiedName() + ", with style binding " + decorable.getAnnotation().annotationType().getName());
@Override public void generateDecorator(Decorable decorable, FactoryController controller) { try { final Timed timed = (Timed) decorable.getAnnotation();
initStmts.add(declareFinalVariable(hanldeVarName, parameterizedAs(RefHolder.class, typeParametersOf(BindingRegistrationHandle.class)), newObject(RefHolder.class))); initStmts.add(loadVariable(hanldeVarName).invoke("set", invokeStatic(StyleBindingsRegistry.class, "get") .invoke("addStyleBinding", decorable.getAnnotation().annotationType(), bindExec)));
initStmts.add(declareFinalVariable(hanldeVarName, parameterizedAs(RefHolder.class, typeParametersOf(BindingRegistrationHandle.class)), newObject(RefHolder.class))); initStmts.add(loadVariable(hanldeVarName).invoke("set", invokeStatic(StyleBindingsRegistry.class, "get") .invoke("addStyleBinding", decorable.getAnnotation().annotationType(), bindExec)));
final Bound bound = (Bound) decorable.getAnnotation(); final boolean propertyIsEmpty = bound.property().equals(""); String property = propertyIsEmpty ? decorable.getName() : bound.property();
final Bound bound = (Bound) decorable.getAnnotation(); final boolean propertyIsEmpty = bound.property().equals(""); String property = propertyIsEmpty ? decorable.getName() : bound.property();
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)) {
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)) {