Examples of ListType


Examples of apigen.adt.ListType

      Iterator<Type> types = api.typeIterator(moduleName);

      while (types.hasNext()) {
        Type type = types.next();
        if (type instanceof ListType) {
          ListType listType = (ListType) type;
          JavaGenerationParameters params = getJavaGenerationParameters();
          String typeName = TypeGenerator.qualifiedClassName(params,
              type.getId());
          String methodName = "make" + TypeGenerator.className(type);
          String paramTypeName = TypeGenerator.qualifiedClassName(
              params, listType.getElementType());
          String empty = emptyListVariable(type);

          if (type instanceof SeparatedListType) {
            SeparatedListType sepListType = (SeparatedListType) type;
            genMakeEmptyList(typeName, methodName, empty,
                forwarding, moduleName);
            genMakeSingletonSeparatedList(typeName, methodName,
                paramTypeName, sepListType, empty, forwarding,
                moduleName);
            genMakeManySeparatedList(sepListType.getElementType(),
                typeName, methodName, paramTypeName,
                sepListType, forwarding, moduleName);
            if (!forwarding) {
              genMakeManySeparatedTermList(typeName, methodName,
                  sepListType);
            }
            genMakeFixedSizedSeparatedList(typeName, methodName,
                sepListType, forwarding, moduleName);
            genReverseSeparatedLists(sepListType, methodName,
                forwarding, moduleName);
            genConcatSeparatedLists(sepListType, methodName,
                forwarding, moduleName);
            genAppendSeparatedLists(sepListType, methodName,
                forwarding, moduleName);
          } else {
            genMakeEmptyList(typeName, methodName, empty,
                forwarding, moduleName);
            genMakeSingletonList(typeName, methodName,
                paramTypeName, empty, forwarding, moduleName);
            genMakeManyList(listType.getElementType(), typeName,
                methodName, paramTypeName, forwarding,
                moduleName);
            if (!forwarding) {
              genMakeManyTermList(typeName, methodName);
            }
View Full Code Here

Examples of com.facebook.swift.parser.model.ListType

            return type.getClass() == ListType.class;
        }

        public String convert(final ThriftType type, final boolean ignored)
        {
            final ListType listType = ListType.class.cast(type);

            final String actualType = TypeToJavaConverter.this.convert(listType.getType(), false);

            return "List<" + actualType + ">";
        }
View Full Code Here

Examples of com.facebook.swift.parser.model.ListType

        }

        @Override
        public String convert(final ThriftType type, final boolean ignored)
        {
            final ListType listType = ListType.class.cast(type);

            final String actualType = TypeToJavaConverter.this.convert(listType.getType(), false);

            return "List<" + actualType + ">";
        }
View Full Code Here

Examples of com.facebook.swift.parser.model.ListType

            return type.getClass() == ListType.class;
        }

        public String convert(final ThriftType type, final boolean ignored)
        {
            final ListType listType = ListType.class.cast(type);

            final String actualType = TypeToJavaConverter.this.convert(listType.getType(), false);

            return "List<" + actualType + ">";
        }
View Full Code Here

Examples of com.facebook.swift.parser.model.ListType

            return type.getClass() == ListType.class;
        }

        public String convert(final ThriftType type, final boolean ignored)
        {
            final ListType listType = ListType.class.cast(type);

            final String actualType = TypeToJavaConverter.this.convert(listType.getType(), false);

            return "List<" + actualType + ">";
        }
View Full Code Here

Examples of com.facebook.swift.parser.model.ListType

        }

        @Override
        public String convert(final ThriftType type, final boolean ignored)
        {
            final ListType listType = ListType.class.cast(type);

            final String actualType = TypeToJavaConverter.this.convert(listType.getElementType(), false);

            return "List<" + actualType + ">";
        }
View Full Code Here

Examples of com.mattinsler.guiceymongo.data.generator.type.ListType

    builder.append(template.toString());
  }
 
  @Override
  public void createWrapperMethod(Appendable builder, ListProperty property, int indentCount) throws IOException {
    ListType type = property.getType();

    String s =
        "/**\n" +
        " * $p.comment$\n" +
        " */\n" +
        "protected $p.listType$ $p.memberVariableName$ = null;\n" +
        "/**\n" +
        " * $p.comment$\n" +
        " */\n" +
        "@Override\n" +
        "public int get$p.camelCaseName$Count() {\n" +
          "$p.listType$ list = get$p.camelCaseName$List();\n" +
          "return list == null ? 0 : list.size();\n" +
        "}\n" +
        "/**\n" +
        " * $p.comment$\n" +
        " */\n" +
        "@SuppressWarnings(\"unchecked\")\n" +
        "@Override\n" +
        "public $p.listType$ get$p.camelCaseName$List() {\n" +
          "if ($p.memberVariableName$ == null) {\n" +
            "Object value = _backing.get($p.keyName$);\n" +
            "if (value != null && value instanceof java.util.List<?>) {\n";

    if (type.getItemType() instanceof UserEnumType) {
      s +=
              "$p.listType$ list = new $p.newListType$();\n" +
              "for (String item : (java.util.List<String>)value) {\n" +
                "try {\n" +
                  "list.add($p.listItemType$.valueOf(item));\n" +
                "} catch (Exception e) {\n" +
                "}\n" +
              "}\n" +
              "$p.memberVariableName$ = java.util.Collections.unmodifiableList(list);\n";
    } else if (type.getItemType() instanceof UserDataType) {
      s +=
              "$p.listType$ list = new $p.newListType$();\n" +
              "for (com.mongodb.DBObject o : (java.util.List<com.mongodb.DBObject>)value)\n" +
                "list.add($p.listItemType$.wrap(o));\n" +
              "$p.memberVariableName$ = java.util.Collections.unmodifiableList(list);\n";
View Full Code Here

Examples of com.mattinsler.guiceymongo.data.generator.type.ListType

//    return this;
//  }
 
  @Override
  public void createUpdaterMethod(Appendable builder, ListProperty property, int indentCount) throws IOException {
    ListType type = property.getType();
    Type itemType = type.getItemType();
   
    // member variable
    if (itemType instanceof UserDataType)
      appendIndent(builder, indentCount).append("protected java.util.List<").append(itemType.getJavaType()).append(".Updater> ").append(property.getMemberVariableName()).append("Added = null;\n");
    else
      appendIndent(builder, indentCount).append("protected ").append(type.getJavaType()).append(" ").append(property.getMemberVariableName()).append("Added = null;\n");
   
    // getCount
    appendIndent(builder, indentCount).append("@Override public int get").append(property.getCamelCaseName()).append("Count() {\n");
    appendIndent(builder, indentCount + 1).append("return _wrapper.").append(property.getMemberVariableName()).append(" != nullgetCount() || _builder.getCount();\n");
    appendIndent(builder, indentCount).append("}\n");
   
    // getList
    if (itemType instanceof UserDataType)
      appendIndent(builder, indentCount).append("@Override public java.util.List<").append(itemType.getJavaType()).append(".Builder> get").append(property.getCamelCaseName()).append("List() {\n");
    else
      appendIndent(builder, indentCount).append("@Override public ").append(type.getJavaType()).append(" get").append(property.getCamelCaseName()).append("List() {\n");
    appendIndent(builder, indentCount + 1).append("return ").append(property.getMemberVariableName()).append(";\n");
    appendIndent(builder, indentCount).append("}\n");
   
    // get
    if (itemType instanceof UserDataType)
      appendIndent(builder, indentCount).append("@Override public ").append(type.getItemType().getJavaType()).append(".Builder get").append(property.getCamelCaseName()).append("(int index) {\n");
    else
      appendIndent(builder, indentCount).append("@Override public ").append(type.getItemType().getJavaType()).append(" get").append(property.getCamelCaseName()).append("(int index) {\n");
    appendIndent(builder, indentCount + 1).append("return ").append(property.getMemberVariableName()).append(" == null ? null : ").append(property.getMemberVariableName()).append(".get(index);\n");
    appendIndent(builder, indentCount).append("}\n");
   
    // add
    if (itemType instanceof UserDataType)
View Full Code Here

Examples of com.odiago.flumebase.lang.ListType

  }

  @Override
  public List<Type> getArgumentTypes() {
    List<Type> args = new ArrayList<Type>();
    args.add(new NullableType(new ListType(mArgType)));
    args.add(Type.getPrimitive(Type.TypeName.INT));
    return args;
  }
View Full Code Here

Examples of com.odiago.flumebase.lang.ListType

  }

  @Override
  public List<Type> getArgumentTypes() {
    List<Type> args = new ArrayList<Type>();
    args.add(new NullableType(new ListType(mArgType)));
    args.add(mArgType);
    return args;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.