Package com.google.gwt.core.ext.typeinfo

Examples of com.google.gwt.core.ext.typeinfo.JMethod


  private void generateProxyMethods(SourceWriter w,
      SerializableTypeOracle serializableTypeOracle) {

    JMethod[] methods = serviceIntf.getOverridableMethods();
    for (int i = 0; i < methods.length; ++i) {
      JMethod method = methods[i];
      generateProxyEncode(w, serializableTypeOracle, method);
      generateAsynchronousProxyMethod(w, method);
    }
  }
View Full Code Here


   */
  public static List /* <String> */validate(JClassType streamReaderClass,
      JClassType streamWriterClass, JClassType serializer, JClassType serializee) {
    List /* <String> */reasons = new ArrayList/* <String> */();

    JMethod deserialize = serializer.findMethod("deserialize", new JType[] {
        streamReaderClass, serializee});
    if (!isValidCustomFieldSerializerMethod(deserialize, JPrimitiveType.VOID)) {
      reasons.add(MessageFormat.format(NO_DESERIALIZE_METHOD, new String[] {
          serializer.getQualifiedSourceName(),
          streamReaderClass.getQualifiedSourceName(),
          serializee.getQualifiedSourceName()}));
    }

    JMethod serialize = serializer.findMethod("serialize", new JType[] {
        streamWriterClass, serializee});
    if (!isValidCustomFieldSerializerMethod(serialize, JPrimitiveType.VOID)) {
      reasons.add(MessageFormat.format(NO_SERIALIZE_METHOD, new String[] {
          serializer.getQualifiedSourceName(),
          streamWriterClass.getQualifiedSourceName(),
          serializee.getQualifiedSourceName()}));
    }

    if (!serializee.isDefaultInstantiable()) {
      JMethod instantiate = serializer.findMethod("instantiate",
          new JType[] {streamReaderClass});
      if (!isValidCustomFieldSerializerMethod(instantiate, serializee)) {
        reasons.add(MessageFormat.format(NO_INSTANTIATE_METHOD, new String[] {
            serializer.getQualifiedSourceName(),
            serializee.getQualifiedSourceName(),
View Full Code Here

    sb.append(serviceIntf.getSimpleSourceName());
    sb.append("Async {\n");

    JMethod[] methods = serviceIntf.getOverridableMethods();
    for (int index = 0; index < methods.length; ++index) {
      JMethod method = methods[index];
      assert (method != null);

      sb.append("\tvoid ");
      sb.append(method.getName());
      sb.append("(");

      JParameter[] params = method.getParameters();
      for (int paramIndex = 0; paramIndex < params.length; ++paramIndex) {
        JParameter param = params[paramIndex];

        if (paramIndex > 0) {
          sb.append(", ");
View Full Code Here

            + " methods than the synchronous version", null);
        failed = true;
      } else {
        Map asyncMethodMap = initializeAsyncMethodMap(asyncMethods);
        for (int i = 0; i < syncMethods.length; ++i) {
          JMethod syncMethod = syncMethods[i];
          String asyncSig = computeAsyncMethodSignature(syncMethod);
          JMethod asyncMethod = (JMethod) asyncMethodMap.get(asyncSig);
          if (asyncMethod == null) {
            branch.branch(TreeLogger.ERROR,
                "Missing asynchronous version of the synchronous method '"
                    + syncMethod.getReadableDeclaration() + "'", null);
            failed = true;
          } else if (asyncMethod.getReturnType() != JPrimitiveType.VOID) {
            branch.branch(TreeLogger.ERROR,
                "The asynchronous version of the synchronous method '"
                    + syncMethod.getReadableDeclaration()
                    + "' must have a 'void' return type", null);
            failed = true;
View Full Code Here

   * corresponding asynchronous {@link JMethod}.
   */
  private Map initializeAsyncMethodMap(JMethod[] asyncMethods) {
    Map /* <String,JClassType> */sigs = new TreeMap();
    for (int i = 0; i < asyncMethods.length; ++i) {
      JMethod asyncMethod = asyncMethods[i];
      sigs.put(computeInternalSignature(asyncMethod), asyncMethod);
    }
    return sigs;
  }
View Full Code Here

    JMethod[] methods = remoteService.getOverridableMethods();

    logger = logger.branch(TreeLogger.DEBUG, "Analyzing methods:", null);

    for (int i = 0; i < methods.length; ++i) {
      JMethod method = methods[i];
      TreeLogger methodLogger = logger.branch(TreeLogger.DEBUG,
          method.toString(), null);
      JType returnType = method.getReturnType();
      TreeLogger returnTypeLogger = methodLogger.branch(TreeLogger.DEBUG,
          "Return type: " + returnType.getParameterizedQualifiedSourceName(),
          null);
      checkForUnparameterizedType(returnTypeLogger, returnType);
      checkType(returnTypeLogger, returnType, true);

      JParameter[] params = method.getParameters();
      for (int j = 0; j < params.length; ++j) {
        JParameter param = params[j];
        TreeLogger paramLogger = methodLogger.branch(TreeLogger.DEBUG,
            "Parameter: " + param.toString(), null);
        JType paramType = param.getType();
        checkForUnparameterizedType(paramLogger, paramType);
        checkType(paramLogger, paramType, true);
      }

      JType[] exs = method.getThrows();
      if (exs.length > 0) {
        checkTypes(methodLogger.branch(TreeLogger.DEBUG, "Throws:", null),
            method.getThrows());
      }
    }
  }
View Full Code Here

        }
        return officials.toArray(new String[officials.size()]);
    }
   
    public static JType getPropertyType(JClassType type, String propertyName) {
        JMethod method = findGetterMethod(type, propertyName);
        if (method != null) {
            return method.getReturnType();
        }
        method = findSetterMethod(type, propertyName);
        return (method == null) null : method.getParameters()[0].getType();
    }
View Full Code Here

        }
        return field;
    }

    public static JMethod findGetterMethod(JClassType type, String propertyName) {
        JMethod method = null;
        JClassType currentType = type;
        while (currentType != null) {
            method = currentType.findMethod(createGetGetterName(propertyName), new JType[0]);
            if (method != null) {
                break;
View Full Code Here

        return method;
    }

    public static JMethod findSetterMethod(JClassType type, String propertyName) {
        String setterName = createSetterName(propertyName);
        JMethod method = null;
        JClassType currentType = type;
        while (currentType != null) {
            JMethod[] methods = currentType.getMethods();
            for (JMethod m : methods) {
                if (m.getName().equals(setterName) && m.getParameters().length == 1) {
View Full Code Here

    private boolean isCascade(JProperty property) {
        JField field = property.getField();
        if (field != null && field.isAnnotationPresent(Valid.class)) {
            return true;
        }
        JMethod getter = property.getGetter();
        return getter != null && getter.isAnnotationPresent(Valid.class);
    }
View Full Code Here

TOP

Related Classes of com.google.gwt.core.ext.typeinfo.JMethod

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.