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

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


        String methodName = component.initMethodName();
        if (StringUtils.hasLength(methodName)) {
            return methodName;
        }

        JMethod initMethod = findAnnotatedMethod(returnType, Initializer.class);
        if (initMethod == null) {
            return null;
        }
        return initMethod.getName();
    }
View Full Code Here


        Component component = method.getAnnotation(Component.class);
        String methodName = component.disposeMethodName();
        if (StringUtils.hasLength(methodName)) {
            return methodName;
        }
        JMethod disposeMethod = findAnnotatedMethod(returnType, Disposer.class);
        if (disposeMethod == null) {
            return null;
        }
        return disposeMethod.getName();
    }
View Full Code Here

        for(JParameter param : method.getParameters() ){
            sw.println("streamWriter."+ this.getWriteCallName(param.getType()) +"("+param.getName()+");");
        }
        sw.outdent();
        try{
            JMethod asyncMethod = this.getAsyncMethod(asyncType, method);
            String callbackParam = asyncMethod.getParameters()[asyncMethod.getParameters().length-1].getName();
           
            sw.println("return invoke(streamWriter.toString(),"+callbackParam+");");
            sw.outdent();
            sw.println("}catch(Exception se){");
            sw.indent();
View Full Code Here

            + " property");
        throw new CssCompilerException("No image property specified");
      }

      // Find the image accessor method
      JMethod imageMethod = null;
      JMethod[] allMethods = bundleType.getOverridableMethods();
      for (int i = 0; imageMethod == null && i < allMethods.length; i++) {
        JMethod candidate = allMethods[i];
        // If the function name matches and takes no parameters
        if (candidate.getName().equals(functionName)
            && candidate.getParameters().length == 0) {
          // We have a match
          imageMethod = candidate;
        }
      }
View Full Code Here

          assert def.getValues().size() == 1;
          assert def.getValues().get(0).isIdentValue() != null;
          String functionName = def.getValues().get(0).isIdentValue().getIdent();

          // Find the method
          JMethod method = context.getResourceBundleType().findMethod(
              functionName, new JType[0]);

          if (method == null) {
            logger.log(TreeLogger.ERROR, "Unable to find DataResource method "
                + functionName + " in "
View Full Code Here

              + currentType.getQualifiedSourceName());
          throw new UnableToCompleteException();
        }

        try {
          JMethod m = referenceType.getMethod(pathElement, new JType[0]);
          currentType = m.getReturnType();
        } catch (NotFoundException e) {
          logger.log(TreeLogger.ERROR, "Could not find no-arg method named "
              + pathElement + " in type "
              + currentType.getQualifiedSourceName());
          throw new UnableToCompleteException();
View Full Code Here

        ensureStaticGetTypeMethodExists(eventType);

        JClassType handlerType = findHandlerType(eventType);
        handlerTypeName = handlerType.getQualifiedSourceName();

        JMethod handlerMethod = findHandlerMethod(handlerType);
        handlerMethodName = handlerMethod.getName();

        // Warn if handlerMethodName is different
        if (!handlerMethodName.equals(functionName)) {
            logger.log(TreeLogger.WARN, getErrorPrefix(eventTypeName, handlerTypeName)
                    + ". The handler method '" + handlerMethodName + "' differs from the annotated method '"
View Full Code Here

            logger.log(TreeLogger.ERROR, getErrorPrefix(eventTypeName, handlerTypeName)
                    + ", but the handler interface has more than one method.");
            throw new UnableToCompleteException();
        }

        JMethod handlerMethod = handlerType.getMethods()[0];
        if (handlerMethod.getReturnType().isPrimitive() != JPrimitiveType.VOID) {
            logger.log(TreeLogger.WARN, getErrorPrefix(eventTypeName, handlerTypeName)
                    + ", but the handler's method does not return void. Return value will be ignored.");
        }
        return handlerMethod;
    }
View Full Code Here

        return handlerMethod;
    }

    private JClassType findHandlerType(JClassType eventType)
            throws UnableToCompleteException {
        JMethod eventMethod = eventInspector.findMethod("dispatch",
                classCollection.eventHandlerClass);
        if (eventMethod == null) {
            logger.log(TreeLogger.ERROR, getErrorPrefix(eventType.getName())
                    + ", but the event class has no valid 'dispatch' method.");
            throw new UnableToCompleteException();
        }
        return eventMethod.getParameters()[0].getType().isClassOrInterface();
    }
View Full Code Here

        return eventMethod.getParameters()[0].getType().isClassOrInterface();
    }

    private void ensureStaticGetTypeMethodExists(JClassType eventType)
            throws UnableToCompleteException {
        JMethod getTypeMethod = eventType.findMethod("getType", new JType[0]);
        if (getTypeMethod == null
                || !getTypeMethod.isStatic()
                || getTypeMethod.getParameters().length != 0) {
            logger.log(TreeLogger.ERROR, getErrorPrefix(eventType.getName())
                    + ", but this event class does not have a static getType method with no parameters.");
            throw new UnableToCompleteException();
        }

        JClassType getTypeReturnType = getTypeMethod.getReturnType().isClassOrInterface();
        if (getTypeReturnType == null
                || !classCollection.gwtEventTypeClass.isAssignableFrom(getTypeReturnType)) {
            logger.log(TreeLogger.ERROR, getErrorPrefix(eventType.getName())
                    + ", but this event class getType() method does not return on object of type "
                    + ClassCollection.gwtEventTypeClassName);
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.