Пример #1
0
 @NotNull
 public static String getDefaultInitializer(@NotNull Field f) {
   if (f.getType().isNullable()) {
     return "null";
   } else {
     String typeToKotlin = f.getType().toKotlin();
     if (typeToKotlin.equals("Boolean")) return "false";
     if (typeToKotlin.equals("Char")) return "' '";
     if (typeToKotlin.equals("Double")) return "0." + OperatorConventions.DOUBLE + "()";
     if (typeToKotlin.equals("Float")) return "0." + OperatorConventions.FLOAT + "()";
     return "0";
   }
 }
Пример #2
0
 @NotNull
 private static List<Parameter> createParametersFromFields(@NotNull List<? extends Field> fields) {
   List<Parameter> result = new LinkedList<Parameter>();
   for (Field f : fields)
     result.add(new Parameter(new IdentifierImpl("_" + f.getIdentifier().getName()), f.getType()));
   return result;
 }