Top Inners Fields Constructors Methods
org.aspectj.util

public Class LangUtil

extends Object
Class Inheritance
Imports
java.io.ByteArrayOutputStream, .File, .IOException, .PrintWriter, .StringWriter, java.lang.reflect.Array, .InvocationTargetException, java.security.PrivilegedActionException, java.sql.SQLException, java.util.ArrayList, .Arrays, .BitSet, .Collection, .Collections, .LinkedList, .List, .Map, .StringTokenizer

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
LangUtil.ProcessController

Handle an external process asynchrously.

public static class
LangUtil.StringChecker

check if input contains any packages to elide.

Field Summary

Modifier and TypeField and Description
public static final String
public static final String
private static double

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static boolean

Returns:

true if input + delimiter added to sink
addIfNotEmpty
(String
ignored if null
input
,
StringBuffer
the StringBuffer to add input to - return false if null
sink
,
String
the String to append to input when added - ignored if empty
delimiter
)

public static List<String>

Returns:

List of String of elements.
anySplit
(String
String to split.
input
,
String
String separators for input.
delim
)

Splits input, removing delimiter and trimming any white space.

public static <T> List<T>

Returns:

the List corresponding to array (never null)
arrayAsList
(T[]
the Object[] to convert (may be null)
array
)

Replacement for Arrays.asList(..) which gacks on null and returns a List in which remove is an unsupported operation.

public static List<String>

Returns:

List of String of elements.
commaSplit
(String
String to split.
input
)

Splits input at commas, trimming any white space.

public static String[][]
copyStrings(String[][] in)

copy non-null two-dimensional String[][]

pack-priv static void
elideEndingLines(LangUtil.StringChecker
returns true if trailing line should be elided.
checker
,
StringBuffer
StringBuffer with lines to elide
stack
,
int
int for maximum number of resulting lines
maxLines
)

Trim ending lines from a StringBuffer, clipping to maxLines and further removing any number of trailing lines accepted by checker.

public static String[]

Returns:

String[] of args remaining after extracting options to extracted
extractOptions
(String[]
the String[] input options
args
,
String[][]
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.
options
)

Extract options and arguments to input option list, returning remainder.

public static boolean

Returns:

true if value is set to true, false otherwise
getBoolean
(String propertyName, boolean defaultValue)

Get System property as boolean, but use default value where the system property is not set.

public static File

Returns:

File associated with the java command, or null if not found.
getJavaExecutable
()

Find java executable File path from java.home system property.

public static String
private static List<Integer>
public static String
public static double
public static String

Returns:

the vm version (1.1, 1.2, 1.3, 1.4, etc)
getVmVersionString
()

public static boolean
public static boolean
public static boolean
public static boolean
public static boolean
public static boolean
public static boolean
public static boolean
public static boolean
public static boolean
public static boolean
is1dot3VMOrGreater()

Deprecated
public static boolean
is1dot4VMOrGreater()

Deprecated
public static boolean
is1dot5VMOrGreater()

Deprecated
public static boolean
is1dot6VMOrGreater()

Deprecated
public static boolean
is1dot7VMOrGreater()

Deprecated
public static boolean
public static boolean
public static boolean
public static boolean
public static boolean

Returns:

((null == s) || (0 == s.length()));
isEmpty
(String s)

public static boolean

Returns:

((null == ra) || (0 == ra.length))
isEmpty
(Object[] ra)

public static boolean

Returns:

((null == ra) || (0 == ra.length))
isEmpty
(byte[] ra)

public static boolean

Returns:

((null == collection) || (0 == collection.size()))
isEmpty
(Collection<?> collection)

public static boolean

Returns:

((null == map) || (0 == map.size()))
isEmpty
(Map<?, ?> map)

public static String

Returns:

String combining classpath elements
makeClasspath
(String bootclasspath, String classpath, String classesDir, String outputJar)

Gen classpath.

public static LangUtil.ProcessController

Returns:

initialized ProcessController
makeProcess
(LangUtil.ProcessController
the ProcessController to initialize, if not null
controller
,
String classpath, String mainClass, String[] args)

Create or initialize a process controller to run a process in another VM asynchronously.

public static String
renderException(Throwable
Throwable to print.
t
)

Renders exception t after unwrapping and eliding any test packages.

public static String
renderException(Throwable
Throwable to print.
t
,
boolean
true to limit to 100 lines and elide test packages
elide
)

Renders exception t, unwrapping, optionally eliding and limiting total number of lines.

public static String

Returns:

"({UnqualifiedExceptionClass}) {message}"
renderExceptionShort
(Throwable e)

public static String
replace(String in, String sought, String replace)

inefficient way to replace all instances of sought with replace

public static Object[]

Returns:

an array with the same component type as sink containing any assignable elements in source (in the same order).
safeCopy
(Object[] source, Object[] sink)

Convert arrays safely.

public static <T> List<T>

Returns:

a non-null unmodifiable List
safeList
(List<T> list)

public static boolean

Returns:

true if delay succeeded, false if interrupted 100 times
sleepUntil
(long
the long time in milliseconds to sleep until
time
)

Sleep until a particular time.

public static String[]
split(String
String to split.
text
)

Splits text at whitespace.

public static String[]

Returns:

String[] of classpath entries
splitClasspath
(String
the String to split - may be null or empty
classpath
)

Split string as classpath, delimited at File.pathSeparator.

public static StringBuffer
stackToString(Throwable throwable, boolean skipMessage)

Dump message and stack to StringBuffer.

public static List<String>
strings(String
String to split.
text
)

Splits strings into a List using a StringTokenizer.

public static final void
throwIaxIfFalse(final boolean test, final String message)

Shorthand for "if false, throw IllegalArgumentException"

public static final void
throwIaxIfNotAssignable(final Object[] ra, final Class<?>
the Class to check - use null to ignore type check
c
,
final String name)

Shorthand for "if not null or not assignable, throw IllegalArgumentException"

public static final void
throwIaxIfNotAssignable(final Object o, final Class<?> c, final String name)

Shorthand for "if not null or not assignable, throw IllegalArgumentException"

public static final void
throwIaxIfNull(final Object o, final String name)

Shorthand for "if null, throw IllegalArgumentException"

public static String
toSizedString(long i, int width)

render i right-justified with a given width less than about 40

public static String

Returns:

a String with the unqualified class name of the class (or "null")
unqualifiedClassName
(Class<?> c)

public static String

Returns:

a String with the unqualified class name of the object (or "null")
unqualifiedClassName
(Object o)

public static Throwable

Returns:

Throwable input or tail of any wrapped exception chain
unwrapException
(Throwable t)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait