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

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


    w.indent();
    //   switch (getMethodIndex()) {
    w.write("switch (getMethodIndex()) {");
    w.indent();
    for (int j = 0; j < uiHandlerMethods.length; j++) {
      JMethod uiMethod = uiHandlerMethods[j];

      // case 0:
      w.write("case %s:", j);
      w.indent();

      //   getEventTarget().onClickRoot((ClickEvent) somethingUnlikelyToCollideWithParamNames,
      //       getRoot(), a, b);
      StringBuffer sb = new StringBuffer();
      JParameter[] sourceParameters = sourceMethod.getParameters();
      // Cat the extra parameters i.e. ", a, b"
      JType[] uiHandlerParameterTypes = uiMethod.getParameterTypes();
      if (uiHandlerParameterTypes.length >= 2) {
        sb.append(", getRoot()");
      }
      for (int k = 2; k < uiHandlerParameterTypes.length; k++) {
        JParameter sourceParam = sourceParameters[k + 1];
        sb.append(", ");
        sb.append(sourceParam.getName());
      }
      w.write("getEventTarget().%s((%s) %sEvent%s);", uiMethod.getName(),
          uiHandlerParameterTypes[0].getQualifiedSourceName(), SAFE_VAR_PREFIX,
          sb.toString());
      //   break;
      w.write("break;");
      w.newline();
View Full Code Here


    ArrayList<String> keys = new ArrayList<String>();
    ArrayList<Integer> values = new ArrayList<Integer>();

    // Collect the event types and field names to form the dispatch table
    for (int i = 0; i < uiHandlerMethods.length; i++) {
      JMethod jMethod = uiHandlerMethods[i];
      String eventType = findEventTypeName(jMethod);
      String[] fieldNames = jMethod.getAnnotation(UiHandler.class).value();
      for (String fieldName : fieldNames) {
        if (rootFieldName.equals(fieldName)) {
          fieldName = AbstractUiRenderer.ROOT_FAKE_NAME;
        }
        keys.add(eventType + AbstractUiRenderer.UI_ID_SEPARATOR + fieldName);
View Full Code Here

   */
  private void generateProxyWrapperMethod(SourceWriter srcWriter, JMethod asyncMethod) throws UnableToCompleteException
  {
    try
    {
      JMethod syncMethod = getSyncMethodFromAsync(asyncMethod);
     
      if (syncMethod.getAnnotation(UseSynchronizerToken.class) != null)
      {
        JType asyncReturnType = asyncMethod.getReturnType().getErasedType();
        List<JParameter> parameters = generateProxyWrapperMethodDeclaration(srcWriter, asyncMethod, asyncReturnType);

        generateProxyWrapperMethodCall(srcWriter, syncMethod, asyncMethod, asyncReturnType, parameters);
View Full Code Here

            }
           
            String getterMethod = JClassUtils.getGetterMethod(prop, baseClassType);
            if (getterMethod == null)
            {
              JMethod method = getMethod(baseClassType, prop, new JType[]{});
              if (method == null)
              {
                throw new NoSuchFieldException(propertyPath);
              }
              else
View Full Code Here

   * @param methodName
   * @return
   */
  public static JType getReturnTypeFromMethodClass(JClassType clazz, String methodName, JType[] params)
    {
      JMethod method = getMethod(clazz, methodName, params);
   
    if (method == null)
    {
      return null;
    }
    JType returnType = method.getReturnType();
    return returnType;
    }
View Full Code Here

   * @param params
   * @return
   */
  public static JMethod getMethod(JClassType clazz, String methodName, JType[] params)
    {
      JMethod method = null;
      JClassType superClass = clazz;
      while (method == null && superClass != null)
      {
        method = superClass.findMethod(methodName, params);
        superClass = superClass.getSuperclass();
View Full Code Here

       
        if (((JClassType)expectedType).findConstructor(new JType[]{stringType}) != null)
        {
          return "new "+expectedType.getQualifiedSourceName()+"("+valueVariable+")";
        }
        JMethod valueOfMethod = ((JClassType)expectedType).findMethod("valueOf", new JType[]{stringType});
      if (valueOfMethod != null && valueOfMethod.isStatic())
        {
          return expectedType.getQualifiedSourceName()+".valueOf("+valueVariable+")";
        }
        JMethod fromStringMethod = ((JClassType)expectedType).findMethod("fromString", new JType[]{stringType});
      if (fromStringMethod != null && fromStringMethod.isStatic())
        {
          return expectedType.getQualifiedSourceName()+".fromString("+valueVariable+")";
        }
    }
View Full Code Here

   * @return property type or null, if property is not present
   */
  public static JType getPropertyType(JClassType clazz, String propertyName)
    {
      JType propertyType = null;
      JMethod method = JClassUtils.getMethod(clazz, JClassUtils.getGetterMethod(propertyName, clazz), new JType[]{});
      if (method != null)
      {
        propertyType = method.getReturnType();
      }
      else
      {
        JField field = JClassUtils.getField(clazz, propertyName);
        if (field != null)
View Full Code Here

   * @param allowProtected if this expression allow protected fields and methods access
   * @return an expression in the form {@code <parentVar>.<propertyAccessor>}
   */
  public static String getFieldValueGet(JClassType clazz, String propertyName, String parentVariable, boolean allowProtected)
  {
    JMethod jMethod = JClassUtils.getMethod(clazz, JClassUtils.getGetterMethod(propertyName, clazz), new JType[]{});
    if (jMethod != null && (jMethod.isPublic() || (allowProtected && jMethod.isProtected())))
    {
      return (parentVariable+"."+jMethod.getName()+"()");
    }
    JField field = getField(clazz, propertyName);

    if (field.isPublic() || (allowProtected && field.isProtected()))
    {
View Full Code Here

      out.println(context.dataProvider+".addDataDisplay("+context.getWidget()+");");

      Event event = EventFactory.getEvent("loadDataProvider", dataProviderFactoryMethod);
      String controller = ClientControllers.getController(event.getController(), getDevice());
      JClassType controllerClass = getContext().getTypeOracle().findType(controller);
      JMethod loadDataProviderMethod = JClassUtils.getMethod(controllerClass, event.getMethod(), new JType[]{});
      if (loadDataProviderMethod == null)
      {
        throw new CruxGeneratorException("DataProvider factory method not found: Controller["+event.getController()+"], Method["+event.getMethod()+"].");
      }
      JType returnType = loadDataProviderMethod.getReturnType();
      if (returnType instanceof JClassType)
      {
        context.asyncDataProvider =
          ((JClassType)returnType).isAssignableTo(getContext().getTypeOracle().findType(AsyncDataProvider.class.getCanonicalName()));
      }
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.