Package org.jboss.errai.codegen

Examples of org.jboss.errai.codegen.StringStatement


      if (containingClass != null && !generatedClassVariables.contains(attrVarName)) {
        generatedClassVariables.add(attrVarName);
        containingClass.privateField(attrVarName, ErraiAttribute.class)
          .modifiers(Modifier.Final)
          .initializesWith(
                  Stmt.nestedCall(new StringStatement("entityManager.getMetamodel()", MetaClassFactory.get(ErraiMetamodel.class)))
                  .invoke("entity", Stmt.loadLiteral(lhsType))
                  .invoke("getAttribute", dotNode.getPropertyPath()))
          .finish();
      }

      // XXX need a StringStatement here because codegen can't see fields of anonymous inner classes. (ERRAI-363)
      return Stmt.nestedCall(new StringStatement(attrVarName, MetaClassFactory.get(ErraiAttribute.class)))
              .invoke("get", Stmt.loadVariable(variableName));
    }
View Full Code Here


      }

      // XXX using StringStatement because this gives OutOfScopeException for metamodel:
      // pmm.append(Stmt.loadClassMember("metamodel").invoke("addEntityType",
      // Variable.get(entityTypeVarName)));
      cmm.append(new StringStatement("metamodel.addEntityType(" + entityTypeVarName + ")"));
    }

    // XXX using StringStatement because this gives OutOfScopeException for metamodel:
    // pmm.append(Stmt.loadClassMember("metamodel").invoke("freeze"));
    cmm.append(new StringStatement("metamodel.freeze()"));

    cmm.append(Stmt.loadVariable("metamodel").returnValue());
    cmm.finish();
  }
View Full Code Here

            .initializesWith(Stmt.newObject(generatorType).withParameters(Variable.get("this")))
            .finish();

        // StringStatement is a workaround: codegen says valueGenerator is out of scope when we do
        // this properly
        return new StringStatement("return valueGenerator");

      }
      else {
        return Stmt.throw_(UnsupportedOperationException.class, "Not a generated attribute");
      }
View Full Code Here

        pmm.append(Stmt.loadVariable(entityTypeVarName).invoke("addAttribute", attribSnapshot));
      }

      // XXX using StringStatement because this gives OutOfScopeException for metamodel:
      // pmm.append(Stmt.loadClassMember("metamodel").invoke("addEntityType", Variable.get(entityTypeVarName)));
      pmm.append(new StringStatement("metamodel.addEntityType(" + entityTypeVarName + ")"));
    }

    // XXX using StringStatement because this gives OutOfScopeException for metamodel:
    // pmm.append(Stmt.loadClassMember("metamodel").invoke("freeze"));
    pmm.append(new StringStatement("metamodel.freeze()"));

    pmm.finish();
  }
View Full Code Here

        .initializesWith(Stmt.newObject(generatorType)
                .withParameters(Stmt.loadStatic(classBuilder.getClassDefinition(), "this"), Variable.get("this")))
                .finish();

        // StringStatement is a workaround: codegen says valueGenerator is out of scope when we do this properly
        return new StringStatement("return valueGenerator");

      } else {
        return Stmt.throw_(UnsupportedOperationException.class, "Not a generated attribute");
      }
    }
View Full Code Here

        .initializesWith(Stmt.newObject(generatorType)
                .withParameters(Stmt.loadStatic(classBuilder.getClassDefinition(), "this"), Variable.get("this")))
                .finish();

        // StringStatement is a workaround: codegen says valueGenerator is out of scope when we do this properly
        return new StringStatement("return valueGenerator");

      } else {
        return Stmt.throw_(UnsupportedOperationException.class, "Not a generated attribute");
      }
    }
View Full Code Here

      if (containingClass != null && !generatedClassVariables.contains(attrVarName)) {
        generatedClassVariables.add(attrVarName);
        containingClass.privateField(attrVarName, ErraiAttribute.class)
          .modifiers(Modifier.Final)
          .initializesWith(
                  Stmt.nestedCall(new StringStatement("getMetamodel()", MetaClassFactory.get(ErraiMetamodel.class)))
                  .invoke("entity", Stmt.loadLiteral(lhsType))
                  .invoke("getAttribute", dotNode.getPropertyPath()))
          .finish();
      }

      // XXX need a StringStatement here because codegen can't see fields of anonymous inner classes. (ERRAI-363)
      return Stmt.nestedCall(new StringStatement(attrVarName, MetaClassFactory.get(ErraiAttribute.class)))
              .invoke("get", Stmt.loadVariable(variableName));
    }
View Full Code Here

        pmm.append(Stmt.loadVariable(entityTypeVarName).invoke("addAttribute", attribSnapshot));
      }

      // XXX using StringStatement because this gives OutOfScopeException for metamodel:
      // pmm.append(Stmt.loadClassMember("metamodel").invoke("addEntityType", Variable.get(entityTypeVarName)));
      pmm.append(new StringStatement("metamodel.addEntityType(" + entityTypeVarName + ")"));
    }

    // XXX using StringStatement because this gives OutOfScopeException for metamodel:
    // pmm.append(Stmt.loadClassMember("metamodel").invoke("freeze"));
    pmm.append(new StringStatement("metamodel.freeze()"));

    pmm.finish();
  }
View Full Code Here

      finalParms[i] = Parameter.of(parms[i].getType().getErased(), parms[i].getName(), true);
      parmVars.add(Stmt.loadVariable(parms[i].getName()));
    }

    Statement parameters = (intercepted) ?
        new StringStatement("getParameters()", MetaClassFactory.get(Object[].class)) :
          Stmt.newArray(Object.class).initialize(parmVars.toArray());

    BlockBuilder<?> methodBlock =
        classBuilder.publicMethod(method.getReturnType().getErased(), method.getName(), finalParms);
View Full Code Here

      // be provided by some Provider in the IOC module itself maybe).
      StringBuilder builder = new StringBuilder();
      builder.append("org.jboss.errai.ioc.client.container.IOC.getAsyncBeanManager().lookupBeans(")
              .append(interceptor.getSimpleName())
              .append(".class).iterator().next().getInstance(icc)");
      return new StringStatement(builder.toString());
    }
    else {
      return Stmt.invokeStatic(AsyncBeanFactory.class, "createBean",
              Stmt.newObject(interceptor), Variable.get("icc"));
    }
View Full Code Here

TOP

Related Classes of org.jboss.errai.codegen.StringStatement

Copyright © 2018 www.massapicom. 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.