org.apache.hivemind.service
Class ClassFabUtils

java.lang.Object
  |
  +--org.apache.hivemind.service.ClassFabUtils

public class ClassFabUtils
extends java.lang.Object

Static class containing utility methods.

Author:
Howard Lewis Ship

Method Summary
static void addToStringMethod(ClassFab classFab, java.lang.String toStringResult)
          Adds a toString() method to a class that returns a fixed, pre-computed value.
static java.lang.String generateClassName(java.lang.String baseName)
          Generates a unique class name, which will be in the default package.
static java.lang.String getJavaClassName(java.lang.Class inputClass)
          Javassist needs the class name to be as it appears in source code, even for arrays.
static boolean isToString(java.lang.reflect.Method method)
          Returns true if the method is the standard toString() method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

generateClassName

public static java.lang.String generateClassName(java.lang.String baseName)
Generates a unique class name, which will be in the default package.


getJavaClassName

public static java.lang.String getJavaClassName(java.lang.Class inputClass)
Javassist needs the class name to be as it appears in source code, even for arrays. Invoking getName() on a Class instance representing an array returns the internal format (i.e, "[...;" or something). This returns it as it would appear in Java code.


isToString

public static boolean isToString(java.lang.reflect.Method method)
Returns true if the method is the standard toString() method. Very few interfaces will ever include this method as part of the interface, but we have to be sure.


addToStringMethod

public static void addToStringMethod(ClassFab classFab,
                                     java.lang.String toStringResult)
Adds a toString() method to a class that returns a fixed, pre-computed value.

Parameters:
classFab - ClassFab used to construct the new class.
toStringResult - fixed result to be returned by the method.