Package kieker.tools.common
Class ParameterEvaluationUtils
java.lang.Object
kieker.tools.common.ParameterEvaluationUtils
Collection of command line parameter evaluation functions.
- Since:
- 1.15
- Author:
- Reiner Jung
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckDirectory(File location, String label, com.beust.jcommander.JCommander commander) Check whether the given handle refers to an existing directory.static <T> TcreateFromConfiguration(Class<T> clazz, Configuration configuration, String key, String errorMessage) Instantiate on object from a property.static URLCreate an URL from a given string.static booleanisFileReadable(File file, String label, com.beust.jcommander.JCommander commander) Check whether a specified file is readable.
-
Method Details
-
checkDirectory
public static boolean checkDirectory(File location, String label, com.beust.jcommander.JCommander commander) Check whether the given handle refers to an existing directory.- Parameters:
location- path to the directorylabel- noun or phrase indicating the parameter of the given location, e.g., "input directory"commander- command line handler used to plot the usage message- Returns:
- returns true if the directory exists, else false
-
isFileReadable
public static boolean isFileReadable(File file, String label, com.beust.jcommander.JCommander commander) Check whether a specified file is readable.- Parameters:
file- the file handlelabel- noun or phrase indicating the parameter of the given location, e.g., "configuration file"commander- command line handler used to plot the usage message- Returns:
- true when the file is readable
-
createURL
Create an URL from a given string.- Parameters:
urlString- the url stringlabel- label used to indicate which string- Returns:
- returns an URL or null on error
-
createFromConfiguration
public static <T> T createFromConfiguration(Class<T> clazz, Configuration configuration, String key, String errorMessage) Instantiate on object from a property.- Type Parameters:
T- class type of the object to be instantiated- Parameters:
clazz- class object for the object to be instantiatedconfiguration- configuration object containing the class namekey- key of the entry that should contain the a class nameerrorMessage- error message in case the object cannot be instantiated- Returns:
- returns either an object conforming to the object class or null if the initialization in incomplete
-