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

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


    if (hasCompositeKey())
    {
      for (int i = 0; i < keyPath.length; i++)
      {
        String k = keyPath[i];
        JType jType = JClassUtils.getTypeForProperty(k, targetObjectType);
        String setterMethod = JClassUtils.getSetterMethod(k, targetObjectType, jType);
        srcWriter.println("object."+setterMethod+"((key==null?null:("+jType.getParameterizedQualifiedSourceName()+")key["+i+"]));");
      }
    }
    else
    {
      String k = keyPath[0];
      JType jType = JClassUtils.getTypeForProperty(k, targetObjectType);
      String setterMethod = JClassUtils.getSetterMethod(k, targetObjectType, jType);
      srcWriter.println("object."+setterMethod+"(key);");
    }
    srcWriter.println("}");
    srcWriter.println();
View Full Code Here


    for (String col : keyPath)
    {
      if (!addedColumns.contains(col))
      {
        addedColumns.add(col);
        JType propertyType = getPropertyType(col);
        srcWriter.print(",\\\""+col+"\\\" "+getSQLTypeForProperty(propertyType)+" PRIMARY KEY");
        if (autoIncrement)
        {
          if (!getKeyTypeName().equals("Integer"))
          {
            throw new CruxGeneratorException("Auto increment keys can only be used on integer keys");
          }
          srcWriter.print(" AUTOINCREMENT");
        }
      }
      else
      {
        throw new CruxGeneratorException("Invalid KeyPath for object store ["+objectStoreName+"]. Duplicated column on keyPath ["+col+"]");
      }
    }

    StringBuilder uniqueConstraints = new StringBuilder();
    for (IndexData indexData: indexes)
    {
      if (indexData.unique)
      {
        uniqueConstraints.append(", UNIQUE(");
      }
      boolean firstCostraint = true;
      for (String col : indexData.keyPath)
      {
        if (!addedColumns.contains(col))
        {
          addedColumns.add(col);
          JType propertyType = getPropertyType(col);
          srcWriter.print(",\\\""+col+"\\\" "+getSQLTypeForProperty(propertyType));
        }
        if (indexData.unique)
        {
          if (!firstCostraint)
View Full Code Here

     */
    return field.isPrivate();
  }

  private void writeArrayDeserializationStatements(JArrayType isArray) {
    JType componentType = isArray.getComponentType();
    String readMethodName = Shared.getStreamReadMethodNameFor(componentType);

    if ("readObject".equals(readMethodName)) {
      // Optimize and use the default object custom serializer...
      sourceWriter.println(Object_Array_CustomFieldSerializer.class.getName()
View Full Code Here

      sourceWriter.println("}");
    }
  }

  private void writeArraySerializationStatements(JArrayType isArray) {
    JType componentType = isArray.getComponentType();
    String writeMethodName = Shared.getStreamWriteMethodNameFor(componentType);
    if ("writeObject".equals(writeMethodName)) {
      // Optimize and use the default object custom serializer...
      sourceWriter.println(Object_Array_CustomFieldSerializer.class.getName()
          + ".serialize(streamWriter, instance);");
View Full Code Here

      sourceWriter.println(WEAK_MAPPING_CLASS_NAME + ".set(instance, "
          + "\"server-enhanced-data\", streamReader.readString());");
    }
   
    for (JField serializableField : serializableFields) {
      JType fieldType = serializableField.getType();

      String readMethodName = Shared.getStreamReadMethodNameFor(fieldType);
      String streamReadExpression = "streamReader." + readMethodName + "()";
      if (Shared.typeNeedsCast(fieldType)) {
        streamReadExpression = "(" + fieldType.getQualifiedSourceName() + ") "
            + streamReadExpression;
      }

      if (needsAccessorMethods(serializableField)) {
        sourceWriter.print("set");
View Full Code Here

      sourceWriter.println("streamWriter.writeString((String) "
          + WEAK_MAPPING_CLASS_NAME + ".get(instance, \"server-enhanced-data\"));");
    }
   
    for (JField serializableField : serializableFields) {
      JType fieldType = serializableField.getType();

      String writeMethodName = Shared.getStreamWriteMethodNameFor(fieldType);
      sourceWriter.print("streamWriter.");
      sourceWriter.print(writeMethodName);
      sourceWriter.print("(");
View Full Code Here

  /**
   * Write a getter method for an instance field.
   */
  private void writeFieldGet(JField serializableField) {
    JType fieldType = serializableField.getType();
    String fieldTypeQualifiedSourceName = fieldType.getQualifiedSourceName();
    String fieldName = serializableField.getName();

    maybeSuppressLongWarnings(fieldType);
    sourceWriter.print("private static native ");
    sourceWriter.print(fieldTypeQualifiedSourceName);
View Full Code Here

  /**
   * Write a setter method for an instance field.
   */
  private void writeFieldSet(JField serializableField) {
    JType fieldType = serializableField.getType();
    String fieldTypeQualifiedSourceName = fieldType.getQualifiedSourceName();
    String serializableClassQualifedName = serializableClass.getQualifiedSourceName();
    String fieldName = serializableField.getName();

    maybeSuppressLongWarnings(fieldType);
    sourceWriter.print("private static native void ");
View Full Code Here

  private static JArrayType getArrayType(TypeOracle typeOracle, int rank,
      JType component) {
    assert (rank > 0);

    JArrayType array = null;
    JType currentComponent = component;
    for (int i = 0; i < rank; ++i) {
      array = typeOracle.getArrayType(currentComponent);
      currentComponent = array;
    }
View Full Code Here

  }

  private TypeInfoComputed checkArrayInstantiable(TreeLogger logger, JArrayType array,
      TypePath path, ProblemReport problems) {

    JType leafType = array.getLeafType();
    JWildcardType leafWild = leafType.isWildcard();
    if (leafWild != null) {
      JArrayType arrayType = getArrayType(typeOracle, array.getRank(),
          leafWild.getUpperBound());
      return checkArrayInstantiable(logger, arrayType, path, problems);
    }

    JClassType leafClass = leafType.isClassOrInterface();
    JTypeParameter isLeafTypeParameter = leafType.isTypeParameter();
    if (isLeafTypeParameter != null
        && !typeParametersInRootTypes.contains(isLeafTypeParameter)) {
      // Don't deal with non root type parameters, but make a TIC entry to
      // save time if it recurs.  We assume they're indirectly instantiable.
      TypeInfoComputed tic = getTypeInfoComputed(array, path, true);
      tic.setInstantiableSubtypes(true);
      tic.setInstantiable(false);
      return tic;
    }

    if (!isAllowedByFilter(array, problems)) {
      // Don't deal with filtered out types either, but make a TIC entry to
      // save time if it recurs.  We assume they're not instantiable.
      TypeInfoComputed tic = getTypeInfoComputed(array, path, true);
      tic.setInstantiable(false);
      return tic;
    }

    TypeInfoComputed tic = getTypeInfoComputed(array, path, true);
    if (tic.isDone()) {
      return tic;
    } else if (tic.isPendingInstantiable()) {
      return tic;
    }
    tic.setPendingInstantiable();

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

    TypeInfoComputed leafTic = computeTypeInstantiability(branch, leafType,
        TypePaths.createArrayComponentPath(array, path), problems);
    boolean succeeded = leafTic.hasInstantiableSubtypes();
    if (succeeded) {
      if (leafClass == null) {
        assert leafType.isPrimitive() != null;
        markArrayTypesInstantiable(leafType, array.getRank(), path);
      } else {
        TreeLogger covariantArrayLogger = logger.branch(TreeLogger.DEBUG,
            "Covariant array types");
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.