## org.apache.hadoop.util
Class ReflectionUtils

    java.lang.Object
      org.apache.hadoop.util.ReflectionUtils

    public class ReflectionUtils

extends Object

General reflection utils

Constructor Summary
`ReflectionUtils()`

Method Summary
`static void` `cloneWritableInto(Writable dst, Writable src)` Deprecated.

`static

`<T> T`

`

`copy(Configuration conf, T src, T dst)`
Make a copy of the writable object using serialization to a buffer

`static

`<T> Class<T>`

`

`getClass(T o)`
Return the correctly-typed `Class` of the given object.

`static void` `logThreadInfo(org.apache.commons.logging.Log log, String title, long minInterval)` Log the current thread stacks at INFO level.

`static

`<T> T`

`

`newInstance(Class<T> theClass, Configuration conf)`
Create an object for the given class and initialize it from conf

`static void` `printThreadInfo(PrintWriter stream, String title)` Print all of the thread's information and stack traces.
`static void` `setConf(Object theObject, Configuration conf)` Check and set 'configuration' if necessary.
`static void` `setContentionTracing(boolean val)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ReflectionUtils

    public ReflectionUtils()

Method Detail

### setConf

    public static void setConf(Object theObject,
                               Configuration conf)

  Check and set 'configuration' if necessary.

  Parameters:
    `theObject` - object for which to set configuration
    `conf` - Configuration

### newInstance

    public static <T> T newInstance(Class<T> theClass,
                                    Configuration conf)

  Create an object for the given class and initialize it from conf

  Parameters:
    `theClass` - class of which an object is created
    `conf` - Configuration
  Returns:
    a new object

### setContentionTracing

    public static void setContentionTracing(boolean val)

### printThreadInfo

    public static void printThreadInfo(PrintWriter stream,
                                       String title)

  Print all of the thread's information and stack traces.

  Parameters:
    `stream` - the stream to
    `title` - a string title for the stack trace

### logThreadInfo

    public static void logThreadInfo(org.apache.commons.logging.Log log,
                                     String title,
                                     long minInterval)

  Log the current thread stacks at INFO level.

  Parameters:
    `log` - the logger that logs the stack trace
    `title` - a descriptive title for the call stacks
    `minInterval` - the minimum time from the last

### getClass

    public static <T> Class<T> getClass(T o)

  Return the correctly-typed `Class` of the given object.

  Parameters:
    `o` - object whose correctly-typed `Class` is to be obtained
  Returns:
    the correctly typed `Class` of the given object.

### copy

    public static <T> T copy(Configuration conf,
                             T src,
                             T dst)
                  throws IOException

  Make a copy of the writable object using serialization to a buffer

  Parameters:
    `dst` - the object to copy from
    `src` - the object to copy into, which is destroyed
  Throws:
    `IOException`

### cloneWritableInto

    @Deprecated
    public static void cloneWritableInto(Writable dst,
                                                    Writable src)
                                  throws IOException

  Deprecated.

  Throws:
    `IOException`

Copyright © 2009 The Apache Software Foundation