Package pixy.util

Class LangUtils

java.lang.Object
pixy.util.LangUtils

public class LangUtils
extends java.lang.Object
A common language utility class
Version:
1.0 09/19/2012
Author:
Wen Yu, yuwen_66@yahoo.com
  • Method Summary

    Modifier and Type Method Description
    static long[] doubleToRational​(double number)  
    static java.lang.annotation.Annotation getAnnotation​(java.lang.reflect.AnnotatedElement element, java.lang.String annotationTypeName)  
    static java.lang.String getClassName​(java.lang.Class<?> c)  
    static java.lang.reflect.Type[] getGenericTypeArguments​(java.lang.reflect.Method m, int i)  
    static java.net.URL getLoadedClassLocation​(java.lang.Class<?> cls)
    Java language specific classes return null cSource
    static java.net.URL getLoadedClassLocation​(java.lang.String className)  
    static java.net.URL getLoadedClassURL​(java.lang.String className)  
    static void invokeMain​(java.lang.String... args)  
    static void log​(java.lang.String message, java.io.PrintStream out)  
    static int longToIntHashCode​(long value)
    Converts long value to int hash code.
    static java.net.URI relativize​(java.net.URI base, java.net.URI child)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • doubleToRational

      public static long[] doubleToRational​(double number)
    • getAnnotation

      public static java.lang.annotation.Annotation getAnnotation​(java.lang.reflect.AnnotatedElement element, java.lang.String annotationTypeName)
    • getClassName

      public static java.lang.String getClassName​(java.lang.Class<?> c)
    • getGenericTypeArguments

      public static java.lang.reflect.Type[] getGenericTypeArguments​(java.lang.reflect.Method m, int i)
      Parameters:
      m - Method we want to probe generic type arguments.
      i - the i'th parameter of the method.
      Returns:
      an array of parameterized Types for the i'th argument or an empty array.
    • log

      public static void log​(java.lang.String message, java.io.PrintStream out)
    • getLoadedClassLocation

      public static java.net.URL getLoadedClassLocation​(java.lang.Class<?> cls)
      Java language specific classes return null cSource
    • getLoadedClassLocation

      public static java.net.URL getLoadedClassLocation​(java.lang.String className)
      Parameters:
      className - A fully qualified class name with package information
      Returns:
      The location where the class has been loaded by the Java Virtual Machine or null.
    • getLoadedClassURL

      public static java.net.URL getLoadedClassURL​(java.lang.String className)
    • invokeMain

      public static void invokeMain​(java.lang.String... args)
    • longToIntHashCode

      public static int longToIntHashCode​(long value)
      Converts long value to int hash code.
      Parameters:
      value - long value
      Returns:
      int hash code for the long
    • relativize

      public static java.net.URI relativize​(java.net.URI base, java.net.URI child)