|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.aspectj.util.LangUtil
public class LangUtil
Nested Class Summary | |
---|---|
static class |
LangUtil.ProcessController
Handle an external process asynchrously. |
static class |
LangUtil.StringChecker
check if input contains any packages to elide. |
Field Summary | |
---|---|
static java.lang.String |
EOL
|
Constructor Summary | |
---|---|
LangUtil()
|
Method Summary | ||
---|---|---|
static java.util.List<java.lang.String> |
anySplit(java.lang.String input,
java.lang.String delim)
Splits input , removing delimiter and trimming any white space. |
|
static java.util.List<java.lang.Object> |
arrayAsList(java.lang.Object[] array)
Replacement for Arrays.asList(..) which gacks on null and returns a List in which remove is an unsupported operation. |
|
static java.util.List<java.lang.String> |
commaSplit(java.lang.String input)
Splits input at commas, trimming any white space. |
|
static java.lang.String[][] |
copyStrings(java.lang.String[][] in)
copy non-null two-dimensional String[][] |
|
static java.lang.String[] |
extractOptions(java.lang.String[] args,
java.lang.String[][] options)
Extract options and arguments to input option list, returning remainder. |
|
static boolean |
getBoolean(java.lang.String propertyName,
boolean defaultValue)
Get System property as boolean, but use default value where the system property is not set. |
|
static java.io.File |
getJavaExecutable()
Find java executable File path from java.home system property. |
|
static boolean |
is13VMOrGreater()
|
|
static boolean |
is14VMOrGreater()
|
|
static boolean |
is15VMOrGreater()
|
|
static boolean |
is16VMOrGreater()
|
|
static boolean |
is17VMOrGreater()
|
|
static boolean |
isEmpty(java.util.Collection<?> collection)
|
|
static boolean |
isEmpty(java.lang.Object[] ra)
|
|
static boolean |
isEmpty(java.lang.String s)
|
|
static java.lang.String |
makeClasspath(java.lang.String bootclasspath,
java.lang.String classpath,
java.lang.String classesDir,
java.lang.String outputJar)
Gen classpath. |
|
static LangUtil.ProcessController |
makeProcess(LangUtil.ProcessController controller,
java.lang.String classpath,
java.lang.String mainClass,
java.lang.String[] args)
Create or initialize a process controller to run a process in another VM asynchronously. |
|
static java.lang.String |
renderException(java.lang.Throwable t)
Renders exception t after unwrapping and eliding any test packages. |
|
static java.lang.String |
renderException(java.lang.Throwable t,
boolean elide)
Renders exception t , unwrapping, optionally eliding and limiting total number of lines. |
|
static java.lang.String |
renderExceptionShort(java.lang.Throwable e)
|
|
static java.lang.String |
replace(java.lang.String in,
java.lang.String sought,
java.lang.String replace)
inefficient way to replace all instances of sought with replace |
|
static java.lang.Object[] |
safeCopy(java.lang.Object[] source,
java.lang.Object[] sink)
Convert arrays safely. |
|
static
|
safeList(java.util.List<T> list)
|
|
static boolean |
sleepUntil(long time)
Sleep until a particular time. |
|
static java.lang.String[] |
split(java.lang.String text)
Splits text at whitespace. |
|
static java.lang.String[] |
splitClasspath(java.lang.String classpath)
Split string as classpath, delimited at File.pathSeparator. |
|
static java.lang.StringBuffer |
stackToString(java.lang.Throwable throwable,
boolean skipMessage)
Dump message and stack to StringBuffer. |
|
static java.util.List<java.lang.String> |
strings(java.lang.String text)
Splits strings into a List using a StringTokenizer . |
|
static void |
throwIaxIfFalse(boolean test,
java.lang.String message)
Shorthand for "if false, throw IllegalArgumentException" |
|
static void |
throwIaxIfNotAssignable(java.lang.Object[] ra,
java.lang.Class<?> c,
java.lang.String name)
Shorthand for "if not null or not assignable, throw IllegalArgumentException" |
|
static void |
throwIaxIfNotAssignable(java.lang.Object o,
java.lang.Class<?> c,
java.lang.String name)
Shorthand for "if not null or not assignable, throw IllegalArgumentException" |
|
static void |
throwIaxIfNull(java.lang.Object o,
java.lang.String name)
Shorthand for "if null, throw IllegalArgumentException" |
|
static java.lang.String |
toSizedString(long i,
int width)
render i right-justified with a given width less than about 40 |
|
static java.lang.String |
unqualifiedClassName(java.lang.Class<?> c)
|
|
static java.lang.String |
unqualifiedClassName(java.lang.Object o)
|
|
static java.lang.Throwable |
unwrapException(java.lang.Throwable t)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String EOL
Constructor Detail |
---|
public LangUtil()
Method Detail |
---|
public static boolean is13VMOrGreater()
public static boolean is14VMOrGreater()
public static boolean is15VMOrGreater()
public static boolean is16VMOrGreater()
public static boolean is17VMOrGreater()
public static final void throwIaxIfNull(java.lang.Object o, java.lang.String name)
java.lang.IllegalArgumentException
- "null {name}" if o is nullpublic static final void throwIaxIfNotAssignable(java.lang.Object[] ra, java.lang.Class<?> c, java.lang.String name)
c
- the Class to check - use null to ignore type check
java.lang.IllegalArgumentException
- "null {name}" if o is nullpublic static final void throwIaxIfNotAssignable(java.lang.Object o, java.lang.Class<?> c, java.lang.String name)
java.lang.IllegalArgumentException
- "null {name}" if o is nullpublic static final void throwIaxIfFalse(boolean test, java.lang.String message)
java.lang.IllegalArgumentException
- "{message}" if test is falsepublic static boolean isEmpty(java.lang.String s)
public static boolean isEmpty(java.lang.Object[] ra)
public static boolean isEmpty(java.util.Collection<?> collection)
public static java.lang.String[] split(java.lang.String text)
text
at whitespace.
text
- String
to split.public static java.util.List<java.lang.String> commaSplit(java.lang.String input)
input
at commas, trimming any white space.
input
- String
to split.
public static java.lang.String[] splitClasspath(java.lang.String classpath)
classpath
- the String to split - may be null or empty
public static boolean getBoolean(java.lang.String propertyName, boolean defaultValue)
public static java.util.List<java.lang.String> anySplit(java.lang.String input, java.lang.String delim)
input
, removing delimiter and trimming any white space. Returns an empty collection if the input is null.
If delimiter is null or empty or if the input contains no delimiters, the input itself is returned after trimming white
space.
input
- String
to split.delim
- String
separators for input.
public static java.util.List<java.lang.String> strings(java.lang.String text)
List
using a StringTokenizer
.
text
- String
to split.public static <T> java.util.List<T> safeList(java.util.List<T> list)
public static java.lang.String[][] copyStrings(java.lang.String[][] in)
extractOptions(String[], String[][])
public static java.lang.String[] extractOptions(java.lang.String[] args, java.lang.String[][] options)
String[] options = new String[][] { new String[] { "-verbose" }, new String[] { "-classpath", null } }; String[] args = extractOptions(args, options); boolean verbose = null != options[0][0]; boolean classpath = options[1][1];
args
- the String[] input optionsoptions
- the String[][]options to find in the input args - not null for each String[] component the first subcomponent
is the option itself, and there is one String subcomponent for each additional argument.
public static java.lang.Object[] safeCopy(java.lang.Object[] source, java.lang.Object[] sink)
java.lang.IllegalArgumentException
- if either is nullpublic static java.lang.String unqualifiedClassName(java.lang.Class<?> c)
public static java.lang.String unqualifiedClassName(java.lang.Object o)
public static java.lang.String replace(java.lang.String in, java.lang.String sought, java.lang.String replace)
public static java.lang.String toSizedString(long i, int width)
public static java.lang.String renderExceptionShort(java.lang.Throwable e)
public static java.lang.String renderException(java.lang.Throwable t)
t
after unwrapping and eliding any test packages.
t
- Throwable
to print.#maxStackTrace
public static java.lang.String renderException(java.lang.Throwable t, boolean elide)
t
, unwrapping, optionally eliding and limiting total number of lines.
t
- Throwable
to print.elide
- true to limit to 100 lines and elide test packagesLangUtil.StringChecker.TEST_PACKAGES
public static java.lang.StringBuffer stackToString(java.lang.Throwable throwable, boolean skipMessage)
public static java.lang.Throwable unwrapException(java.lang.Throwable t)
public static java.util.List<java.lang.Object> arrayAsList(java.lang.Object[] array)
array
- the Object[] to convert (may be null)
public static java.lang.String makeClasspath(java.lang.String bootclasspath, java.lang.String classpath, java.lang.String classesDir, java.lang.String outputJar)
bootclasspath
- classpath
- classesDir
- outputJar
-
public static LangUtil.ProcessController makeProcess(LangUtil.ProcessController controller, java.lang.String classpath, java.lang.String mainClass, java.lang.String[] args)
controller
- the ProcessController to initialize, if not nullclasspath
- mainClass
- args
-
public static java.io.File getJavaExecutable()
public static boolean sleepUntil(long time)
time
- the long time in milliseconds to sleep until
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |