Class ParameterEvaluationUtils

java.lang.Object
kieker.tools.common.ParameterEvaluationUtils

public final class ParameterEvaluationUtils extends Object
Collection of command line parameter evaluation functions.
Since:
1.15
Author:
Reiner Jung
  • 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 directory
      label - 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 handle
      label - 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

      public static URL createURL(String urlString, String label)
      Create an URL from a given string.
      Parameters:
      urlString - the url string
      label - 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 instantiated
      configuration - configuration object containing the class name
      key - key of the entry that should contain the a class name
      errorMessage - 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