/** * Gets the args as string. * * @return the args as string */ public String getArgsAsString() { return Converter.toShortString(JoinPointHelper.getArgsAsString(this.args)); }
/** * Instantiates a new archiv entry. * * @param url the url */ public ArchivEntry(URL url) { this.uri = Converter.toURI(url); initArchiv(); }
/** * Gets the parent of the given class. * * @param path * e.g. "jar:file:/a/b/c.jar!/d/e.class * @param clazz * e.gl. "d.e.class" * @return e.g. "jar:file:/a/b/c.jar" */ public static URI getParent(final URI path, final Class<?> clazz) { String resource = Converter.toResource(clazz); return getParent(path, resource); }
/** * An empty array or null is mapped to "[]" (empty array). * * @param array e.g. an int array {1, 2, 3} * @return e.g. "[ 1, 2, 3 ]" */ public static String toString(final Object[] array) { return toString("[ ", " ]", array); }
private static String[] getAsClasspath(final URL[] repositoryURLs) { String[] cp = new String[repositoryURLs.length]; for (int i = 0; i < cp.length; i++) { cp[i] = Converter.toAbsolutePath(Converter.toURI(repositoryURLs[i])); } return cp; }
/** * Instantiates a new simple profile monitor. * * @param label * the label * @param parent * the parent */ public SimpleProfileMonitor(final Signature label, final SimpleProfileMonitor parent) { this(SignatureHelper.getAsString(label), parent); }
/** * Sleep. */ public static void sleep() { sleep(timeInMillis); }
/** * Determines the timer resolution for the sleep() method. On windows this * is 15 ms, on Linux and MacOS 1 ms. * * @return 1 (ms) on Linux and MacOS, 15 (ms) on Windows */ private static long calibrateMillis() { long t0 = nextTimeMillis(); long t1 = nextTimeMillis(); return t1 - t0; }
/** * Converts a string to a date with the help of the given pattern. * If the string can't be converted an IllegalArgumentException will * be thrown. * * @param s e.g. "28-Nov-2009" * @param pattern e.g. "dd-MMM-yyyy" * @return a valid date or NULL_DATE (if an empty string is given) */ public static Date toDate(final String s, final String pattern) { return toDate(s, pattern, true); }
/** * Gets the caller of the given method. * * @param clazz * the clazz * @param methodName * the method name * @return the caller of */ public static StackTraceElement getCallerOf(final Class<?> clazz, final String methodName) { return getCallerOf(clazz, methodName, new Pattern[0]); }
/** * Instantiates a new classpath digger. */ public ClasspathDigger() { this(Environment.getClassLoader()); }
/** * Gets the caller class by examing the stacktrace. * * @param excluded * a list of filters which should be not considered as caller * @return the caller of */ public static Class<?> getCallerClass(final Pattern... excluded) { return getCallerClass(excluded, new Class<?>[0]); }
/** * Instantiates a new detailed zip file. * * @param file the file * @param mode the mode * @param charset the charset * @throws IOException Signals that an I/O exception has occurred. */ public NestedZipFile(File file, int mode, Charset charset) throws IOException { super(getEmbeddedZipFile(file), mode, charset); }
/** * Gets the caller stack trace of the method or constructor which calls it. * * @param excluded * a list of filters which should be not considered as caller * @return the caller stack trace * @since 1.4.2 (17.05.2014) */ public static StackTraceElement[] getCallerStackTrace(final Pattern... excluded) { return getCallerStackTrace(excluded, new Class<?>[0]); }
/** * With this method you can combine several converters. * * @param others * the other converters * @return the string converter */ public final StringConverter and(final StringConverter... others) { return new AndConverter(this, others); }
/** * @see patterntesting.runtime.monitor.ProfileMonitor#getLabel() */ public String getLabel() { if (this.label == null) { return "root"; } else { return SignatureHelper.getAsString(label); } }
/** * Sleep. */ public static void sleep() { sleep(TIME_IN_MILLIS); }
/** * Determines the timer resolution for the sleep() method. * On windows this is 15 ms, on Linux and MacOS 1 ms. * * @return 1 (ms) on Linux and MacOS, 15 (ms) on Windows */ private static long calibrateMillis() { long t0 = nextTimeMillis(); long t1 = nextTimeMillis(); return t1 - t0; }
/** * Gets the caller of the given signature. * * @param signature * the signature * @return the caller of */ public static StackTraceElement getCallerOf(final Signature signature) { return getCallerOf(signature, new Pattern[0]); }
/** * Gets the caller of the given method. * * @param classname * the classname * @param methodName * the method name * @return the caller of */ public static StackTraceElement getCallerOf(final String classname, final String methodName) { return getCallerOf(classname, methodName, new Pattern[0]); }