Esempio n. 1
0
 @NotNull
 private static String createPrimaryConstructorInvocation(
     @NotNull String s,
     @NotNull List<? extends Field> fields,
     @NotNull Map<String, String> initializers) {
   List<String> result = new LinkedList<String>();
   for (Field f : fields) {
     String id = f.getIdentifier().toKotlin();
     result.add(initializers.get(id));
   }
   return s + "(" + AstUtil.join(result, ", ") + ")";
 }
Esempio n. 2
0
  @NotNull
  private static String getPrimitiveTypeConversion(@NotNull String type) {
    Map<String, Name> conversions = new HashMap<String, Name>();
    conversions.put("byte", BYTE);
    conversions.put("short", SHORT);
    conversions.put("int", INT);
    conversions.put("long", LONG);
    conversions.put("float", FLOAT);
    conversions.put("double", DOUBLE);
    conversions.put("char", CHAR);

    conversions.put(JAVA_LANG_BYTE, BYTE);
    conversions.put(JAVA_LANG_SHORT, SHORT);
    conversions.put(JAVA_LANG_INTEGER, INT);
    conversions.put(JAVA_LANG_LONG, LONG);
    conversions.put(JAVA_LANG_FLOAT, FLOAT);
    conversions.put(JAVA_LANG_DOUBLE, DOUBLE);
    conversions.put(JAVA_LANG_CHARACTER, CHAR);

    if (conversions.containsKey(type)) {
      return "." + conversions.get(type) + "()";
    }
    return "";
  }