Package org.jboss.errai.codegen

Examples of org.jboss.errai.codegen.BlockStatement.addStatement()


  private Statement generatePropertiesMap() {
    BlockStatement block = new BlockStatement();
    for (String property : bindable.getBeanDescriptor().getProperties()) {
      MetaMethod readMethod = bindable.getBeanDescriptor().getReadMethodForProperty(property);
      if (readMethod != null && !readMethod.isFinal()) {
        block.addStatement(agent("propertyTypes").invoke(
            "put",
            property,
            Stmt.newObject(PropertyType.class, readMethod.getReturnType().asBoxed().asClass(),
                readMethod.getReturnType().isAnnotationPresent(Bindable.class),
                readMethod.getReturnType().isAssignableTo(List.class))
View Full Code Here


            currentBlock
                .append(lookupMethod);
            currentBlock.modifiers(Modifier.Static).finish();
          }
          else {
            instanceInitializer.addStatement(lookupMethod);
          }
          currentBlock =
              context.getBootstrapBuilder().privateMethod(void.class, "addLookups_" + addLookupMethodCount++);
        }
View Full Code Here

      }
    }

    addTypeHierarchyFor(context, knownTypesWithSuperTypes);

    instanceInitializer.addStatement(Stmt.nestedCall(Stmt.newObject(CDI.class))
            .invoke("initLookupTable", Stmt.invokeStatic(CDIEventTypeLookup.class, "get")));
  }
}
View Full Code Here

          String varName = "uiBinderInst_" + enclosingType.getFullyQualifiedName()
                  .replaceAll("\\.", "_");

          if (Boolean.getBoolean("errai.simulatedClient")) {
            staticInit.addStatement(Stmt.declareVariable(UiBinder.class).named(varName).initializeWith(
                    ObjectBuilder.newInstanceOf(uiBinderBoilerPlaterIface)
                            .extend()
                            .publicOverridesMethod("createAndBindUi", Parameter.of(type, "w"))
                            .append(Stmt.loadLiteral(null).returnValue())
                            .finish().finish()
View Full Code Here

                            .finish().finish()
            )
            );
          }
          else {
            staticInit.addStatement(Stmt.declareVariable(UiBinder.class).named(varName).initializeWith(
                    Stmt.invokeStatic(GWT.class, "create", LiteralFactory.getLiteral(uiBinderBoilerPlaterIface))
            ));
          }

          staticInit.addStatement(Stmt.invokeStatic(UiBinderProvider.class, "registerBinder",
View Full Code Here

            staticInit.addStatement(Stmt.declareVariable(UiBinder.class).named(varName).initializeWith(
                    Stmt.invokeStatic(GWT.class, "create", LiteralFactory.getLiteral(uiBinderBoilerPlaterIface))
            ));
          }

          staticInit.addStatement(Stmt.invokeStatic(UiBinderProvider.class, "registerBinder",
              enclosingType, Refs.get(varName)));
        }
        else if (type.isAssignableTo(SafeHtmlTemplates.class)) {
          final String varName = "safeTemplateInst_" + type.getFullyQualifiedName()
                  .replaceAll("\\.", "_");
View Full Code Here

      if (getJavaMember(attr) instanceof Field) {

        BlockStatement methodBody = new BlockStatement();

        // Now unwrap in case it's a WrappedPortable
        methodBody.addStatement(
            If.instanceOf(Stmt.loadVariable(entityInstanceParam), WrappedPortable.class)
                .append(
                    Stmt.loadVariable(entityInstanceParam).assignValue(
                        Stmt.castTo(WrappedPortable.class, Stmt.loadVariable(entityInstanceParam)).invoke("unwrap")))
                .finish());
View Full Code Here

        MetaField field = MetaClassFactory.get((Field) getJavaMember(attr));

        // Now generate a call to the private accessor method for the field in question.
        // (The write accessor for the field was defined while generating the get() method).
        methodBody.addStatement(
            Stmt.loadVariable("this")
                .invoke(PrivateAccessUtil.getPrivateFieldInjectorName(field),
                    Stmt.castTo(et.getJavaType(), Stmt.loadVariable(entityInstanceParam)),
                    Stmt.castTo(MetaClassFactory.get(attr.getJavaType()).asBoxed(), Stmt.loadVariable(newValueParam))));
View Full Code Here

            new Modifier[]{});

        BlockStatement methodBody = new BlockStatement();

        // Now unwrap in case it's a WrappedPortable
        methodBody.addStatement(
            If.instanceOf(Stmt.loadVariable(entityInstanceParam), WrappedPortable.class)
                .append(
                    Stmt.loadVariable(entityInstanceParam).assignValue(
                        Stmt.castTo(WrappedPortable.class, Stmt.loadVariable(entityInstanceParam)).invoke("unwrap")))
                .finish());
View Full Code Here

                    Stmt.loadVariable(entityInstanceParam).assignValue(
                        Stmt.castTo(WrappedPortable.class, Stmt.loadVariable(entityInstanceParam)).invoke("unwrap")))
                .finish());

        // Now generate a call to the private accessor method for the field in question.
        methodBody.addStatement(
            Stmt.loadVariable("this")
                .invoke(PrivateAccessUtil.getPrivateFieldInjectorName(field),
                    Stmt.castTo(et.getJavaType(), Stmt.loadVariable(entityInstanceParam)))
                .returnValue());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.