diff --git a/modules/swagger-codegen-cli/pom.xml b/modules/swagger-codegen-cli/pom.xml
index 4b0f1731d82..a0a022036e8 100644
--- a/modules/swagger-codegen-cli/pom.xml
+++ b/modules/swagger-codegen-cli/pom.xml
@@ -85,11 +85,6 @@
airline
0.9
-
- com.googlecode.lambdaj
- lambdaj
- 2.3.3
-
org.slf4j
slf4j-simple
diff --git a/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Langs.java b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Langs.java
index 007da38d2f6..559beda5c67 100644
--- a/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Langs.java
+++ b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Langs.java
@@ -1,11 +1,12 @@
package io.swagger.codegen.cmd;
-import ch.lambdaj.collection.LambdaIterable;
import io.airlift.airline.Command;
import io.swagger.codegen.CodegenConfig;
-import static ch.lambdaj.Lambda.on;
-import static ch.lambdaj.collection.LambdaCollections.with;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.StreamSupport;
+
import static java.util.ServiceLoader.load;
/**
@@ -15,8 +16,9 @@
public class Langs implements Runnable {
@Override
public void run() {
- LambdaIterable langs =
- with(load(CodegenConfig.class)).extract(on(CodegenConfig.class).getName());
+ List langs = StreamSupport.stream(load(CodegenConfig.class).spliterator(), false)
+ .map(CodegenConfig::getName)
+ .collect(Collectors.toList());
System.out.printf("Available languages: %s%n", langs);
}
}
diff --git a/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Meta.java b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Meta.java
index b8fe42f3853..22f1a5ee574 100644
--- a/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Meta.java
+++ b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Meta.java
@@ -1,6 +1,5 @@
package io.swagger.codegen.cmd;
-import ch.lambdaj.function.convert.Converter;
import com.google.common.base.CaseFormat;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -20,7 +19,6 @@
import java.util.List;
import java.util.Map;
-import static ch.lambdaj.collection.LambdaCollections.with;
import static com.google.common.base.Joiner.on;
/**
@@ -79,51 +77,44 @@ public void run() {
.put("swaggerCodegenVersion", swaggerVersion).build();
- with(supportingFiles).convert(processFiles(targetDir, data));
+ DefaultGenerator generator = new DefaultGenerator();
+ supportingFiles.forEach(f -> processFile(generator, f, targetDir, data));
}
/**
- * Converter method to process supporting files: execute with mustache, or simply copy to
- * destination directory
+ * Processes a supporting file: execute with mustache, or simply copy to destination directory
*
+ * @param generator - generator used to read templates
+ * @param support - supporting file to process
* @param targetDir - destination directory
* @param data - map with additional params needed to process templates
- * @return converter object to pass to lambdaj
*/
- private static Converter processFiles(final File targetDir,
- final Map data) {
- return new Converter() {
- private DefaultGenerator generator = new DefaultGenerator();
-
- @Override
- public File convert(SupportingFile support) {
- try {
- File destinationFolder =
- new File(new File(targetDir.getAbsolutePath()), support.folder);
- File outputFile = new File(destinationFolder, support.destinationFilename);
-
- String template =
- generator.readTemplate(new File(TEMPLATE_DIR_CLASSPATH,
- support.templateFile).getPath());
- String formatted = template;
-
- if (support.templateFile.endsWith(MUSTACHE_EXTENSION)) {
- LOGGER.info("writing file to {}", outputFile.getAbsolutePath());
- formatted =
- Mustache.compiler().withLoader(loader(generator)).defaultValue("")
- .compile(template).execute(data);
- } else {
- LOGGER.info("copying file to {}", outputFile.getAbsolutePath());
- }
-
- FileUtils.writeStringToFile(outputFile, formatted, StandardCharsets.UTF_8);
- return outputFile;
-
- } catch (IOException e) {
- throw new RuntimeException("Can't generate project", e);
- }
+ private static void processFile(DefaultGenerator generator, SupportingFile support,
+ final File targetDir, final Map data) {
+ try {
+ File destinationFolder =
+ new File(new File(targetDir.getAbsolutePath()), support.folder);
+ File outputFile = new File(destinationFolder, support.destinationFilename);
+
+ String template =
+ generator.readTemplate(new File(TEMPLATE_DIR_CLASSPATH,
+ support.templateFile).getPath());
+ String formatted = template;
+
+ if (support.templateFile.endsWith(MUSTACHE_EXTENSION)) {
+ LOGGER.info("writing file to {}", outputFile.getAbsolutePath());
+ formatted =
+ Mustache.compiler().withLoader(loader(generator)).defaultValue("")
+ .compile(template).execute(data);
+ } else {
+ LOGGER.info("copying file to {}", outputFile.getAbsolutePath());
}
- };
+
+ FileUtils.writeStringToFile(outputFile, formatted, StandardCharsets.UTF_8);
+
+ } catch (IOException e) {
+ throw new RuntimeException("Can't generate project", e);
+ }
}
/**
diff --git a/pom.xml b/pom.xml
index f4af9990d67..6919cfe2053 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,50 +62,10 @@
net.revelc.code
formatter-maven-plugin
-
-
LF
-
org.apache.maven.plugins
maven-surefire-plugin
@@ -178,6 +138,10 @@
org.apache.maven.plugins
maven-source-plugin
${maven-source-plugin-version}
+
+
+ true
+
attach-sources
@@ -218,6 +182,10 @@
true
published
3600
+
+
+ swagger-generator
+