All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.dekorate.option.adapter.GeneratorConfigAdapter Maven / Gradle / Ivy

There is a newer version: 4.1.4
Show newest version
package io.dekorate.option.adapter;

import java.nio.file.Path;
import io.dekorate.option.config.GeneratorConfigBuilder;
import java.lang.String;
import io.dekorate.option.config.GeneratorConfig;
import java.util.Comparator;
import io.dekorate.project.Project;
import io.dekorate.option.annotation.GeneratorOptions;
import io.dekorate.project.BuildInfo;
import java.lang.Object;
import java.util.List;
import io.dekorate.project.ScmInfo;
import java.util.Map;

public class GeneratorConfigAdapter {


    public static GeneratorConfig adapt(GeneratorOptions instance) {
        return newBuilder(instance).build();
    }

    public static GeneratorConfigBuilder newBuilder(GeneratorOptions instance) {
        return new GeneratorConfigBuilder(new io.dekorate.option.config.GeneratorConfig(null,
                    null,
                    instance.inputPath(),
                    instance.outputPath()));
    }

    public static GeneratorConfig adapt(Map map) {
        return new io.dekorate.option.config.GeneratorConfig(
        null,
        null,
                       (String)(map instanceof Map ? ((Map)map).getOrDefault("inputPath", "") : ""),
                       (String)(map instanceof Map ? ((Map)map).getOrDefault("outputPath", "") : ""));
    }

    public static GeneratorConfigBuilder newBuilder(Map map) {
        return new GeneratorConfigBuilder(new io.dekorate.option.config.GeneratorConfig(
        null,
        null,
                       (String)(map instanceof Map ? ((Map)map).getOrDefault("inputPath", "") : ""),
                       (String)(map instanceof Map ? ((Map)map).getOrDefault("outputPath", "") : "")));
    }

    public static String[] toStringArray(Object o) {
                if (o instanceof String[]) {
                  return (String[]) o;
                }
                if (o instanceof String) {
                  String s =  (String) o;
                  return s.split(",[ ]*");
                }
                else if (o instanceof List) {
                  List c = (List) o;
                  String[] result = new String[c.size()]; 
                  for (int i=0; i <= c.size(); i++) {
                    result[i] = String.valueOf(c.get(i));
                  }
                  return result;
                }
                return new String[0];
            
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy