public class EnvUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DOCKER_HTTPS_PORT |
static String |
MAVEN_PROPERTY_REGEXP |
Modifier and Type | Method and Description |
---|---|
static String |
convertTcpToHttpUrl(String connect) |
static List<String> |
extractFromPropertiesAsList(String prefix,
Properties properties)
Extract from given properties a list of string values.
|
static Map<String,String> |
extractFromPropertiesAsMap(String prefix,
Properties properties)
Extract part of given properties as a map.
|
static String |
extractLargerVersion(String versionA,
String versionB)
Compare to version strings and return the larger version strings.
|
static String |
extractMavenPropertyName(String propName)
Extract from a Maven property which is in the form ${name} the name.
|
static String |
findRegistry(String... checkFirst) |
static String |
fixupPath(String path)
Fix path on Windows machines, i.e.
|
static String |
formatDurationTill(long start)
Calculate the duration between now and the given time
Taken mostly from http://stackoverflow.com/a/5062810/207604 .
|
static boolean |
greaterOrEqualsVersion(String versionA,
String versionB)
Check whether the first given API version is larger or equals the second given version
|
static boolean |
isValidWindowsFileName(String filename)
Validate that the provided filename is a valid Windows filename.
|
static boolean |
isWindows() |
static Date |
loadTimestamp(File tsFile) |
static File |
prepareAbsoluteOutputDirPath(MojoParameters params,
String dir,
String path) |
static File |
prepareAbsoluteSourceDirPath(MojoParameters params,
String path) |
static List<String> |
removeEmptyEntries(List<String> input)
Remove empty members of a list.
|
static List<String> |
splitAtCommasAndTrim(Iterable<String> input)
Split each element of an Iterable
|
static List<String[]> |
splitOnLastColon(List<String> listToSplit)
Splits every element in the given list on the last colon in the name and returns a list with
two elements: The left part before the colon and the right part after the colon.
|
static String[] |
splitOnSpaceWithEscape(String toSplit) |
static void |
storeTimestamp(File tsFile,
Date buildDate) |
static String |
stringJoin(List list,
String separator)
Join a list of objects to a string with a given separator by calling Object.toString() on the elements.
|
public static final String MAVEN_PROPERTY_REGEXP
public static final String DOCKER_HTTPS_PORT
public static String extractLargerVersion(String versionA, String versionB)
null
, the other version is returned (which can be null as well)versionA
- first version numberversionB
- second version numberpublic static boolean greaterOrEqualsVersion(String versionA, String versionB)
versionA
- first version to check againstversionB
- the second versionpublic static List<String[]> splitOnLastColon(List<String> listToSplit)
listToSplit
- list of strings to split@Nonnull public static List<String> removeEmptyEntries(@Nullable List<String> input)
input
- A list of String@Nonnull public static List<String> splitAtCommasAndTrim(Iterable<String> input)
input
- Iterable over strings.public static String stringJoin(List list, String separator)
list
- to joinseparator
- separator to usepublic static Map<String,String> extractFromPropertiesAsMap(String prefix, Properties properties)
prefix
- prefix which specifies the part which should be extracted as mapproperties
- properties to extract frompublic static List<String> extractFromPropertiesAsList(String prefix, Properties properties)
prefix
- for selecting the properties from which the list should be extractedproperties
- properties from which to extract frompublic static String extractMavenPropertyName(String propName)
propName
- property name to extratpublic static String fixupPath(String path)
path
- path to fixpublic static String formatDurationTill(long start)
start
- starting time (in milliseconds)public static File prepareAbsoluteOutputDirPath(MojoParameters params, String dir, String path)
public static File prepareAbsoluteSourceDirPath(MojoParameters params, String path)
public static void storeTimestamp(File tsFile, Date buildDate) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
public static Date loadTimestamp(File tsFile) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
public static boolean isWindows()
public static boolean isValidWindowsFileName(String filename)
filename
- the filenameCopyright © 2020. All rights reserved.