Package com.devonfw.cobigen.cli.utils
Class CobiGenUtils
- java.lang.Object
-
- com.devonfw.cobigen.cli.utils.CobiGenUtils
-
public class CobiGenUtils extends java.lang.ObjectUtilities class for CobiGen related operations. For instance, it creates a new CobiGen instance and registers all the plug-ins
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCLI_HOMECLI home folder for pom.xml configuration
-
Constructor Summary
Constructors Constructor Description CobiGenUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.io.FileextractArtificialPom()Extracts an artificial POM which defines all the CobiGen plug-ins that are neededstatic java.nio.file.PathgetCliHomePath()static com.devonfw.cobigen.api.CobiGeninitializeCobiGen(java.nio.file.Path templatesProject)Registers CobiGen plug-ins and instantiates CobiGenstatic java.lang.Objectprocess(com.devonfw.cobigen.api.InputInterpreter inputInterpreter, java.nio.file.Path file, java.lang.ClassLoader cl)Processes the given file to be converted into any CobiGen valid input formatstatic java.lang.ClassLoaderregisterPlugins()Registers the given different CobiGen plug-ins by building an artificial POM extracted next to the CLI location and then adding the needed URLs to the class loader.static java.util.List<com.devonfw.cobigen.api.to.IncrementTo>retainAllIncrements(java.util.List<com.devonfw.cobigen.api.to.IncrementTo> currentList, java.util.List<com.devonfw.cobigen.api.to.IncrementTo> listToIntersect)For Increments Returns a list that retains only the elements in this list that are contained in the specified collection (optional operation).static java.util.List<com.devonfw.cobigen.api.to.TemplateTo>retainAllTemplates(java.util.List<com.devonfw.cobigen.api.to.TemplateTo> currentList, java.util.List<com.devonfw.cobigen.api.to.TemplateTo> listToIntersect)For Templates Returns a list that retains only the elements in this list that are contained in the specified collection (optional operation).
-
-
-
Field Detail
-
CLI_HOME
public static final java.lang.String CLI_HOME
CLI home folder for pom.xml configuration- See Also:
- Constant Field Values
-
-
Method Detail
-
initializeCobiGen
public static com.devonfw.cobigen.api.CobiGen initializeCobiGen(java.nio.file.Path templatesProject)
Registers CobiGen plug-ins and instantiates CobiGen- Parameters:
templatesProject- the templates project or jar- Returns:
- object of CobiGen
-
getCliHomePath
public static java.nio.file.Path getCliHomePath()
- Returns:
- the home path of the CLI
-
registerPlugins
public static java.lang.ClassLoader registerPlugins()
Registers the given different CobiGen plug-ins by building an artificial POM extracted next to the CLI location and then adding the needed URLs to the class loader.- Returns:
- the classloader created for registering plugins
-
extractArtificialPom
public static java.io.File extractArtificialPom()
Extracts an artificial POM which defines all the CobiGen plug-ins that are needed- Returns:
- the extracted POM file
-
retainAllIncrements
public static java.util.List<com.devonfw.cobigen.api.to.IncrementTo> retainAllIncrements(java.util.List<com.devonfw.cobigen.api.to.IncrementTo> currentList, java.util.List<com.devonfw.cobigen.api.to.IncrementTo> listToIntersect)For Increments Returns a list that retains only the elements in this list that are contained in the specified collection (optional operation). In other words, the resultant list removes from this list all of its elements that are not contained in the specified collection.- Parameters:
currentList- list containing elements to be retained in this listlistToIntersect- second list to be used for the intersection- Returns:
- resultant list containing increments that are in both lists
-
retainAllTemplates
public static java.util.List<com.devonfw.cobigen.api.to.TemplateTo> retainAllTemplates(java.util.List<com.devonfw.cobigen.api.to.TemplateTo> currentList, java.util.List<com.devonfw.cobigen.api.to.TemplateTo> listToIntersect)For Templates Returns a list that retains only the elements in this list that are contained in the specified collection (optional operation). In other words, the resultant list removes from this list all of its elements that are not contained in the specified collection.- Parameters:
currentList- list containing elements to be retained in this listlistToIntersect- second list to be used for the intersection- Returns:
- resultant list containing increments that are in both lists
-
process
public static java.lang.Object process(com.devonfw.cobigen.api.InputInterpreter inputInterpreter, java.nio.file.Path file, java.lang.ClassLoader cl) throws com.devonfw.cobigen.api.exception.InputReaderExceptionProcesses the given file to be converted into any CobiGen valid input format- Parameters:
file-Fileconverted into any CobiGen valid input formatcl-ClassLoaderto be used, when considering Java-related inputsinputInterpreter- parse cobiGen compliant input from the file- Returns:
- a CobiGen valid input
- Throws:
com.devonfw.cobigen.api.exception.InputReaderException- if the input retrieval did not result in a valid CobiGen input
-
-