com.opensymphony.xwork2.util.profiling

## Class ObjectProfiler

- java.lang.Object
- - com.opensymphony.xwork2.util.profiling.ObjectProfiler

- Deprecated.
  will be dropped with next major release (2.6)

      @Deprecated
      public class ObjectProfiler
      extends Object

  Author:
    Scott Farquhar

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ObjectProfiler()` Deprecated.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Object` | `getProfiledObject(Class interfaceClazz, Object o)` Deprecated. Given a class, and an interface that it implements, return a proxied version of the class that implements the interface.
    `static String` | `getTrimmedClassName(Method method)` Deprecated. Given a method, get the Method name, with no package information.
    `static Object` | `profiledInvoke(Method target, Object value, Object[] args)` Deprecated. A profiled call `Method.invoke(java.lang.Object, java.lang.Object[])`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ObjectProfiler

          public ObjectProfiler()

      Deprecated.

  - ### Method Detail

    - #### getProfiledObject

          public static Object getProfiledObject(Class interfaceClazz,
                                 Object o)

      Deprecated.

      Given a class, and an interface that it implements, return a proxied version of the class that implements the interface.

      The usual use of this is to profile methods from Factory objects:

           public PersistenceManager getPersistenceManager()
           {
             return new DefaultPersistenceManager();
           }

           instead write:
           public PersistenceManager getPersistenceManager()
           {
             return ObjectProfiler.getProfiledObject(PersistenceManager.class, new DefaultPersistenceManager());
           }

      A side effect of this is that you will no longer be able to downcast to DefaultPersistenceManager. This is probably a *good* thing.

      Parameters:
        `interfaceClazz` - The interface to implement.
        `o` - The object to proxy
      Returns:
        A proxied object, or the input object if the interfaceClazz wasn't an interface.

    - #### profiledInvoke

          public static Object profiledInvoke(Method target,
                              Object value,
                              Object[] args)
                                       throws IllegalAccessException,
                                              InvocationTargetException

      Deprecated.
      A profiled call `Method.invoke(java.lang.Object, java.lang.Object[])`. If `UtilTimerStack.isActive()` returns false, then no profiling is performed.
      Parameters:
        `target` - target method
        `value` - value
        `args` - arguments
      Returns:
        target object
      Throws:
        `IllegalAccessException` - in case of access errors
        `InvocationTargetException` - in case of invocation errors

    - #### getTrimmedClassName

          public static String getTrimmedClassName(Method method)

      Deprecated.
      Given a method, get the Method name, with no package information.
      Parameters:
        `method` - method
      Returns:
        method name, with no package information

Copyright © 2000–2020 Apache Software Foundation. All rights reserved.