Klasse LangUtil

java.lang.Object
org.aspectj.util.LangUtil

public class LangUtil extends Object
  • Felddetails

  • Konstruktordetails

    • LangUtil

      public LangUtil()
  • Methodendetails

    • getVmVersionString

      public static String getVmVersionString()
      Gibt zurück:
      the vm version (1.1, 1.2, 1.3, 1.4, etc)
    • getVmVersion

      public static double getVmVersion()
    • is1dot3VMOrGreater

      @Deprecated public static boolean is1dot3VMOrGreater()
      Veraltet.
    • is1dot4VMOrGreater

      @Deprecated public static boolean is1dot4VMOrGreater()
      Veraltet.
    • is1dot5VMOrGreater

      @Deprecated public static boolean is1dot5VMOrGreater()
      Veraltet.
    • is1dot6VMOrGreater

      @Deprecated public static boolean is1dot6VMOrGreater()
      Veraltet.
    • is1dot7VMOrGreater

      @Deprecated public static boolean is1dot7VMOrGreater()
      Veraltet.
    • is1dot8VMOrGreater

      public static boolean is1dot8VMOrGreater()
    • is9VMOrGreater

      public static boolean is9VMOrGreater()
    • is10VMOrGreater

      public static boolean is10VMOrGreater()
    • is11VMOrGreater

      public static boolean is11VMOrGreater()
    • is12VMOrGreater

      public static boolean is12VMOrGreater()
    • is13VMOrGreater

      public static boolean is13VMOrGreater()
    • is14VMOrGreater

      public static boolean is14VMOrGreater()
    • is15VMOrGreater

      public static boolean is15VMOrGreater()
    • is16VMOrGreater

      public static boolean is16VMOrGreater()
    • is17VMOrGreater

      public static boolean is17VMOrGreater()
    • is18VMOrGreater

      public static boolean is18VMOrGreater()
    • is19VMOrGreater

      public static boolean is19VMOrGreater()
    • is20VMOrGreater

      public static boolean is20VMOrGreater()
    • is21VMOrGreater

      public static boolean is21VMOrGreater()
    • is22VMOrGreater

      public static boolean is22VMOrGreater()
    • throwIaxIfNull

      public static final void throwIaxIfNull(Object o, String name)
      Shorthand for "if null, throw IllegalArgumentException"
      Löst aus:
      IllegalArgumentException - "null {name}" if o is null
    • throwIaxIfNotAssignable

      public static final void throwIaxIfNotAssignable(Object[] ra, Class<?> c, String name)
      Shorthand for "if not null or not assignable, throw IllegalArgumentException"
      Parameter:
      c - the Class to check - use null to ignore type check
      Löst aus:
      IllegalArgumentException - "null {name}" if o is null
    • throwIaxIfNotAssignable

      public static final void throwIaxIfNotAssignable(Object o, Class<?> c, String name)
      Shorthand for "if not null or not assignable, throw IllegalArgumentException"
      Löst aus:
      IllegalArgumentException - "null {name}" if o is null
    • throwIaxIfFalse

      public static final void throwIaxIfFalse(boolean test, String message)
      Shorthand for "if false, throw IllegalArgumentException"
      Löst aus:
      IllegalArgumentException - "{message}" if test is false
    • isEmpty

      public static boolean isEmpty(String s)
      Gibt zurück:
      ((null == s) || (0 == s.length()));
    • isEmpty

      public static boolean isEmpty(Object[] ra)
      Gibt zurück:
      ((null == ra) || (0 == ra.length))
    • isEmpty

      public static boolean isEmpty(byte[] ra)
      Gibt zurück:
      ((null == ra) || (0 == ra.length))
    • isEmpty

      public static boolean isEmpty(Collection<?> collection)
      Gibt zurück:
      ((null == collection) || (0 == collection.size()))
    • isEmpty

      public static boolean isEmpty(Map<?,?> map)
      Gibt zurück:
      ((null == map) || (0 == map.size()))
    • split

      public static String[] split(String text)
      Splits text at whitespace.
      Parameter:
      text - String to split.
    • commaSplit

      public static List<String> commaSplit(String input)
      Splits input at commas, trimming any white space.
      Parameter:
      input - String to split.
      Gibt zurück:
      List of String of elements.
    • splitClasspath

      public static String[] splitClasspath(String classpath)
      Split string as classpath, delimited at File.pathSeparator. Entries are not trimmed, but empty entries are ignored.
      Parameter:
      classpath - the String to split - may be null or empty
      Gibt zurück:
      String[] of classpath entries
    • getBoolean

      public static boolean getBoolean(String propertyName, boolean defaultValue)
      Get System property as boolean, but use default value where the system property is not set.
      Gibt zurück:
      true if value is set to true, false otherwise
    • anySplit

      public static List<String> anySplit(String input, String delim)
      Splits 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.
      Parameter:
      input - String to split.
      delim - String separators for input.
      Gibt zurück:
      List of String of elements.
    • strings

      public static List<String> strings(String text)
      Splits strings into a List using a StringTokenizer.
      Parameter:
      text - String to split.
    • safeList

      public static <T> List<T> safeList(List<T> list)
      Gibt zurück:
      a non-null unmodifiable List
    • copyStrings

      public static String[][] copyStrings(String[][] in)
      copy non-null two-dimensional String[][]
      Siehe auch:
    • extractOptions

      public static String[] extractOptions(String[] args, String[][] options)
      Extract options and arguments to input option list, returning remainder. The input options will be nullified if not found. e.g.,
       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];
       
      Parameter:
      args - the String[] input options
      options - 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.
      Gibt zurück:
      String[] of args remaining after extracting options to extracted
    • safeCopy

      public static Object[] safeCopy(Object[] source, Object[] sink)
      Convert arrays safely. The number of elements in the result will be 1 smaller for each element that is null or not assignable. This will use sink if it has exactly the right size. The result will always have the same component type as sink.
      Gibt zurück:
      an array with the same component type as sink containing any assignable elements in source (in the same order).
      Löst aus:
      IllegalArgumentException - if either is null
    • unqualifiedClassName

      public static String unqualifiedClassName(Class<?> c)
      Gibt zurück:
      a String with the unqualified class name of the class (or "null")
    • unqualifiedClassName

      public static String unqualifiedClassName(Object o)
      Gibt zurück:
      a String with the unqualified class name of the object (or "null")
    • replace

      public static String replace(String in, String sought, String replace)
      inefficient way to replace all instances of sought with replace
    • toSizedString

      public static String toSizedString(long i, int width)
      render i right-justified with a given width less than about 40
    • renderExceptionShort

      public static String renderExceptionShort(Throwable e)
      Gibt zurück:
      "({UnqualifiedExceptionClass}) {message}"
    • renderException

      public static String renderException(Throwable t)
      Renders exception t after unwrapping and eliding any test packages.
      Parameter:
      t - Throwable to print.
      Siehe auch:
      • LangUtil.StringChecker.TEST_PACKAGES
    • renderException

      public static String renderException(Throwable t, boolean elide)
      Renders exception t, unwrapping, optionally eliding and limiting total number of lines.
      Parameter:
      t - Throwable to print.
      elide - true to limit to 100 lines and elide test packages
      Siehe auch:
      • LangUtil.StringChecker.TEST_PACKAGES
    • stackToString

      public static StringBuffer stackToString(Throwable throwable, boolean skipMessage)
      Dump message and stack to StringBuffer.
    • unwrapException

      public static Throwable unwrapException(Throwable t)
      Gibt zurück:
      Throwable input or tail of any wrapped exception chain
    • arrayAsList

      public static <T> List<T> arrayAsList(T[] array)
      Replacement for Arrays.asList(..) which gacks on null and returns a List in which remove is an unsupported operation.
      Parameter:
      array - the Object[] to convert (may be null)
      Gibt zurück:
      the List corresponding to array (never null)
    • makeClasspath

      public static String makeClasspath(String bootclasspath, String classpath, String classesDir, String outputJar)
      Gen classpath.
      Parameter:
      bootclasspath -
      classpath -
      classesDir -
      outputJar -
      Gibt zurück:
      String combining classpath elements
    • makeProcess

      public static LangUtil.ProcessController makeProcess(LangUtil.ProcessController controller, String classpath, String mainClass, String[] args)
      Create or initialize a process controller to run a process in another VM asynchronously.
      Parameter:
      controller - the ProcessController to initialize, if not null
      classpath -
      mainClass -
      args -
      Gibt zurück:
      initialized ProcessController
    • getJavaExecutable

      public static File getJavaExecutable()
      Find java executable File path from java.home system property.
      Gibt zurück:
      File associated with the java command, or null if not found.
    • sleepUntil

      public static boolean sleepUntil(long time)
      Sleep until a particular time.
      Parameter:
      time - the long time in milliseconds to sleep until
      Gibt zurück:
      true if delay succeeded, false if interrupted 100 times
    • getJrtFsFilePath

      public static String getJrtFsFilePath()
    • getJavaHome

      public static String getJavaHome()