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

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


          property = jsonProperty.value();
         
        } else {
          property = JClassUtils.getPropertyForGetterOrSetterMethod(method);
        }
        JType paramType = method.getParameterTypes()[0];
        String serializerName = getSerializerForType(paramType);
        srcWriter.println(resultObjectVar+"."+method.getName()+"(new "+serializerName+"().decode("+jsonObjectVar+".get("+EscapeUtils.quote(property)+")));");
      }
    }
   
View Full Code Here


         
        } else {
          property = JClassUtils.getPropertyForGetterOrSetterMethod(method);
        }
       
        JType returnType = method.getReturnType();
        String serializerName = getSerializerForType(returnType);
        boolean primitive = returnType.isPrimitive() != null;
        if (!primitive)
        {
          srcWriter.println("if ("+objectVar+"."+method.getName()+"() != null){");
        }
        srcWriter.println(resultJSONValueVar+".isObject().put("+EscapeUtils.quote(property)+", new "+serializerName+"().encode("+objectVar+"."+method.getName()+"()));");
View Full Code Here

      else
      {
        needsComma = true;
      }

      JType paramType = param.getType();
      paramType = paramType.getErasedType();

      w.print(paramType.getQualifiedSourceName());
      w.print(" ");

      String paramName = param.getName();
      nameFactory.addName(paramName);
      w.print(paramName);
View Full Code Here

      else
      {
        w.print(" throws ");
        needsComma = true;
      }
      JType throwType = methodThrow.getErasedType();
      w.print(throwType.getQualifiedSourceName());
        }
    }
View Full Code Here

      else
      {
        needsComma = true;
      }

      JType paramType = param.getType();
      if (i == (params.length - 1))
      {
        srcWriter.print("final ");
      }
      srcWriter.print(paramType.getParameterizedQualifiedSourceName());
      srcWriter.print(" ");

      String paramName = param.getName();
      parameters.add(param);
      srcWriter.print(paramName);
View Full Code Here

        {
          StringBuilder getExpression = new StringBuilder();
          StringBuilder checkNullExpression = new StringBuilder();
         
          getExpression.append(objectVariable);
          JType baseType = dtoType;
          JClassType baseClassType = baseType.isClassOrInterface();
          for (int i=0; i < props.length; i++)
          {
            if (baseClassType == null && i < props.length-1)
            {
              throw new NoSuchFieldException(propertyPath);
            }
            String prop = props[i];
            if (i>0)
            {
              if (i>1)
              {
                checkNullExpression.append(" || ");
              }
              checkNullExpression.append(getExpression.toString()+"==null ");
            }
           
            String getterMethod = JClassUtils.getGetterMethod(prop, baseClassType);
            if (getterMethod == null)
            {
              JMethod method = getMethod(baseClassType, prop, new JType[]{});
              if (method == null)
              {
                throw new NoSuchFieldException(propertyPath);
              }
              else
              {
                getterMethod = prop;
              }
            }
            getExpression.append("."+getterMethod+"()");
            baseType = JClassUtils.getReturnTypeFromMethodClass(baseClassType, getterMethod, new JType[]{});
            baseClassType = baseType.isClassOrInterface();
          }
          if (finishCommand)
          {
            getExpression.append(";");
          }
View Full Code Here

       
        if (props != null && props.length > 0)
        {
          StringBuilder getExpression = new StringBuilder();
          getExpression.append(objectVariable);
          JType baseType = dtoType;
          JClassType baseClassType = baseType.isClassOrInterface();
          for (int i=0; i < props.length-1; i++)
          {
            if (baseClassType == null && i < props.length-1)
            {
              throw new NoSuchFieldException(propertyPath);
            }
            String prop = props[i];
            JClassType propertyType = getTypeForProperty(prop, baseClassType).isClassOrInterface();
           
            String getterMethod = getGetterMethod(prop, baseClassType);
            String setterMethod = getSetterMethod(prop, baseClassType, propertyType);

            out.println("if ("+getExpression.toString()+"."+getterMethod+"()==null){");
            out.println(getExpression+"."+setterMethod+"(("+propertyType.getParameterizedQualifiedSourceName()+")"+GWT.class.getCanonicalName()+".create("+propertyType.getQualifiedSourceName()+".class));");
            out.println("}");
            getExpression.append("."+getterMethod+"()");
           
            baseClassType = propertyType;
          }
        String prop = props[props.length-1];
        JType propertyType = getTypeForProperty(prop, baseClassType);
      String setterMethod = getSetterMethod(prop, baseClassType, propertyType);
      out.println(getExpression+"."+setterMethod+"("+value+");");
         
          return propertyType;
        }
View Full Code Here

      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

   
    if (method == null)
    {
      return null;
    }
    JType returnType = method.getReturnType();
    return returnType;
    }
View Full Code Here

   * @param propertyName property name
   * @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();
      }
View Full Code Here

TOP

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

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.