Package org.jboss.errai.codegen.framework

Examples of org.jboss.errai.codegen.framework.Statement


          anno = type.getAnnotation(dec.decoratesWith());
          break;

      }

      Statement stmt = dec.generateDecorator(new InjectableInstance(anno, taskType, constructor, method, field, type,
              parm, injector, ctx));

      ctx.getProcessingContext().append(stmt);
    }
    return true;
View Full Code Here


    /**
     * Ensure the the container generates a stub to internally expose the field if it's private.
     */
    decContext.ensureMemberExposed();

    final Statement busHandle = ctx.getInjector(MessageBus.class).getType(ctx, decContext);

    /**
     * Figure out the service name;
     */
    final String svcName = decContext.getAnnotation().value().equals("")
View Full Code Here

    if (!method.isPublic()) {
      instance.ensureMemberExposed();
    }

    Statement callbackStmt = Stmt.newObject(Runnable.class).extend()
            .publicOverridesMethod("run")
            .append(instance.callOrBind())
            .finish()
            .finish();
View Full Code Here

         * Start binding of fields here.
         */
        for (MemberMapping memberMapping : mapping.getMemberMappings()) {
          if (!memberMapping.canWrite()) continue;

          Statement bindingStatement;
          Statement val;
          if (memberMapping.getType().isArray()) {
            val = context.getArrayMarshallerCallback()
                    .demarshall(memberMapping.getType(), extractJSONObjectProperty(memberMapping.getKey(), EJObject.class));
          }
          else {
View Full Code Here

  public Statement fieldDemarshall(Mapping mapping, Class<?> fromType) {
    return fieldDemarshall(mapping, MetaClassFactory.get(fromType));
  }

  public Statement fieldDemarshall(Mapping mapping, MetaClass fromType) {
    Statement statement = unwrapJSON(extractJSONObjectProperty(mapping.getKey(), fromType), mapping.getType());
    if (!mapping.getTargetType().equals(mapping.getType())) {
      return Cast.to(mapping.getTargetType(), statement);
    }
    else {
      return statement;
View Full Code Here

      if (!targetType.isEnum() && !context.canMarshal(compType.getFullyQualifiedName())) {
        throw new NoAvailableMarshallerException(compType.getFullyQualifiedName());
      }

      Statement valueStatement = valueAccessorFor(mapping.getReadingMember());
      if (targetType.isArray()) {
        valueStatement = context.getArrayMarshallerCallback().marshal(targetType, valueStatement);
      }
      sb.append("\"" + mapping.getKey() + "\" : ");
View Full Code Here

  public static Statement marshal(Parameter param, String contentType) {
    return marshal(param.getType(), Variable.get(param.getName()), contentType);
  }

  public static Statement marshal(MetaClass type, Statement statement, String contentType) {
    Statement marshallingStatement = null;
    if (PrimitiveTypeMarshaller.canHandle(type, contentType)) {
      marshallingStatement = PrimitiveTypeMarshaller.marshal(type, statement);
    }
    else {
      marshallingStatement = Stmt.invokeStatic(Marshalling.class, "toJSON", statement);
View Full Code Here

  public static Statement demarshal(Parameter param, String accepts) {
    return demarshal(param.getType(), Variable.get(param.getName()), accepts);
  }

  public static Statement demarshal(MetaClass type, Statement statement, String accepts) {
    Statement demarshallingStatement = null;
    if (PrimitiveTypeMarshaller.canHandle(type, accepts)) {
      demarshallingStatement = PrimitiveTypeMarshaller.demarshal(type, statement);
    }
    else {
      demarshallingStatement = Stmt.invokeStatic(Marshalling.class, "fromJSON", statement);
View Full Code Here

   *
   * @param method
   * @return statement representing the GWT RequestBuilder method
   */
  public static Statement fromMethod(MetaMethod method) {
    Statement gwtRequestMethod = null;
    for (Class<? extends Annotation> jaxrsMethod : METHOD_MAP.keySet()) {
      if (method.isAnnotationPresent(jaxrsMethod)) {
        gwtRequestMethod = METHOD_MAP.get(jaxrsMethod);
        break;
      }
View Full Code Here

    ContextualStatementBuilder sendRequest = Stmt.loadVariable("requestBuilder");
    if (resourceMethod.getParameters().getEntityParameter() == null) {
      sendRequest = sendRequest.invoke("sendRequest", null, createRequestCallback());
    }
    else {
      Statement body = marshal(resourceMethod.getParameters().getEntityParameter(),
          resourceMethod.getContentTypeHeader());
      sendRequest = sendRequest.invoke("sendRequest", body, createRequestCallback());
    }

    methodBlock.append(Stmt
View Full Code Here

TOP

Related Classes of org.jboss.errai.codegen.framework.Statement

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.