Package rocket.generator.rebind.methodparameter

Examples of rocket.generator.rebind.methodparameter.NewMethodParameter


    // rename all parameters to parameterN
    GeneratorHelper.renameParametersToParameterN(newMethod);

    // the last parameter must be called "callback"
    final List parameters = newMethod.getParameters();
    final NewMethodParameter callback = (NewMethodParameter) parameters.get(parameters.size() - 1);
    callback.setName(Constants.CALLBACK_PARAMETER);

    context.debug("Finishing renaming parameters, parameters: " + parameters);

    return newMethod;
  }
View Full Code Here


    readFields.setNative(false);
    readFields.setReturnType(context.getVoid());
    readFields.setStatic(false);
    readFields.setVisibility(Visibility.PROTECTED);

    final NewMethodParameter readFieldsJsonObjectParameter = readFields.newParameter();
    readFieldsJsonObjectParameter.setFinal(true);
    readFieldsJsonObjectParameter.setName("jsonObject");
    final Type jsonObjectType = this.getJsonObject();
    readFieldsJsonObjectParameter.setType(jsonObjectType);

    final NewMethodParameter readFieldsInstanceParameter = readFields.newParameter();
    readFieldsInstanceParameter.setFinal(true);
    readFieldsInstanceParameter.setName("instance");
    readFieldsInstanceParameter.setType(type);

    final CodeBlockList body = new CodeBlockList();
    readFields.setBody(body);

    final Type stringType = context.getString();

    final Iterator fields = type.getFields().iterator();
    while (fields.hasNext()) {
      final Field field = (Field) fields.next();
      if (field.isStatic() || field.isTransient()) {
        continue;
      }
      if (field.isFinal()) {
        throwFinalFieldsCannotBeDeserialized(field);
      }

      final SetFieldTemplatedFile writeMethodBody = new SetFieldTemplatedFile();
      writeMethodBody.setField(field);

      // create the setter method itself.
      final NewMethod setter = deserializer.newMethod();
      setter.setAbstract(false);
      setter.setFinal(false);
      setter.setName(GeneratorHelper.buildSetterName(field.getName()));
      setter.setNative(true);
      setter.setReturnType(context.getVoid());
      setter.setStatic(false);
      setter.setVisibility(Visibility.PRIVATE);
      setter.setBody(writeMethodBody);

      // add its instance parameter
      final NewMethodParameter setterInstanceParameter = setter.newParameter();
      setterInstanceParameter.setFinal(true);
      setterInstanceParameter.setName(Constants.SET_FIELD_INSTANCE_PARAMETER);
      setterInstanceParameter.setType(type);

      // add the value parameter
      final NewMethodParameter setterValueParameter = setter.newParameter();
      setterValueParameter.setFinal(true);
      setterValueParameter.setName(Constants.SET_FIELD_VALUE_PARAMETER);
      setterValueParameter.setType(field.getType());

      final Type fieldType = field.getType();

      if (fieldType.equals(context.getLong())) {
        setter.addMetaData("com.google.gwt.core.client.UnsafeNativeLong", "");
View Full Code Here

    final List parameters = asyncMethod.getParameters();
    if (parameters.size() != 2) {
      throwInvalidJsonRpcMethod(method);
    }

    final NewMethodParameter parameter = (NewMethodParameter) parameters.get(0);
    parameter.setName(JsonConstants.INVOKER_PARAMETER_PARAMETER);
    final NewMethodParameter callback = (NewMethodParameter) parameters.get(1);
    callback.setName(JsonConstants.INVOKER_CALLBACK_PARAMETER);

    final JsonRpcInvokerTemplatedFile body = new JsonRpcInvokerTemplatedFile();
    body.setParameterType(parameter.getType());
    body.setReturnType(method.getReturnType());
    asyncMethod.setBody(body);
View Full Code Here

    body.setParameters(asyncMethod.getParameters());
    body.setReturnType(method.getReturnType());

    final Iterator newMethodParameters = asyncMethod.getParameters().iterator();
    while (newMethodParameters.hasNext()) {
      final NewMethodParameter parameter = (NewMethodParameter) newMethodParameters.next();
      parameter.setFinal(true);

      if (false == newMethodParameters.hasNext()) {
        parameter.setName(RequestParametersConstants.REQUEST_PARAMETERS_CALLBACK_PARAMETER);
      }
    }

    asyncMethod.setBody(body);
  }
View Full Code Here

    final NewMethod newReadObject = readObject.copy(deserializer);
    newReadObject.setAbstract(false);
    newReadObject.setFinal(false);
    newReadObject.setNative(false);

    final NewMethodParameter jsonValue = (NewMethodParameter) newReadObject.getParameters().get(0);
    jsonValue.setName(Constants.READ_COMPLEX_JSON_VALUE_PARAMETER);
    jsonValue.setFinal(true);

    final ReadComplexTemplatedFile body = new ReadComplexTemplatedFile();
    body.setDeserializerType(type);

    newReadObject.setBody(body);
View Full Code Here

    writeFields.setNative(false);
    writeFields.setReturnType(context.getVoid());
    writeFields.setStatic(false);
    writeFields.setVisibility(Visibility.PROTECTED);

    final NewMethodParameter instanceParameter = writeFields.newParameter();
    instanceParameter.setFinal(true);
    instanceParameter.setName(Constants.WRITE_FIELDS_INSTANCE_PARAMETER);
    instanceParameter.setType(context.getObject());

    final NewMethodParameter jsonObjectParameter = writeFields.newParameter();
    jsonObjectParameter.setFinal(true);
    jsonObjectParameter.setName(Constants.WRITE_FIELD_JSON_OBJECT_PARAMETER);
    final Type jsonObjectType = this.getJsonObject();
    jsonObjectParameter.setType(jsonObjectType);

    final WriteFieldsTemplatedFile body = new WriteFieldsTemplatedFile();
    body.setInstanceType(type);
    writeFields.setBody(body);
View Full Code Here

    if (fieldType.equals(context.getLong())) {
      getter.addMetaData("com.google.gwt.core.client.UnsafeNativeLong", "");
    }

    final NewMethodParameter instance = getter.newParameter();
    instance.setName(Constants.GET_FIELD_INSTANCE_PARAMETER);
    instance.setFinal(true);
    instance.setType(field.getEnclosingType());

    final GetFieldTemplatedFile getterBody = new GetFieldTemplatedFile();
    getterBody.setField(field);
    getter.setBody(getterBody);
View Full Code Here

    final InvokeMethodTemplatedFile body = new InvokeMethodTemplatedFile();
    body.setType(beanType);
    body.setMethod(initMethod);

    final NewMethodParameter instanceParameter = (NewMethodParameter) newMethod.getParameters().get(0);
    instanceParameter.setFinal(true);
    instanceParameter.setName(Constants.SATISFY_INIT_INSTANCE_PARAMETER);

    newMethod.setBody(body);
  }
View Full Code Here

    newMethod.setNative(false);

    final SetPropertiesTemplatedFile body = new SetPropertiesTemplatedFile();
    newMethod.setBody(body);

    final NewMethodParameter instanceParameter = (NewMethodParameter) newMethod.getParameters().get(0);
    instanceParameter.setFinal(true);
    instanceParameter.setName(Constants.SATISFY_PROPERTIES_INSTANCE_PARAMETER);

    final Type serviceDefTarget = this.getServiceDefTarget();
    body.setBean(serviceDefTarget);

    final GeneratorContext context = this.getGeneratorContext();
View Full Code Here

    final NewMethod newMethod = method.copy(factoryBean);
    newMethod.setAbstract(false);
    newMethod.setFinal(true);
    newMethod.setNative(false);

    final NewMethodParameter instanceParameter = (NewMethodParameter) newMethod.getParameters().get(0);
    instanceParameter.setFinal(true);
    instanceParameter.setName(Constants.SATISFY_PROPERTIES_INSTANCE_PARAMETER);

    newMethod.setBody(body);

    // loop thru all properties
    final Set<Property> properties = bean.getProperties();
View Full Code Here

TOP

Related Classes of rocket.generator.rebind.methodparameter.NewMethodParameter

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.