Example usage for java.lang Class getCanonicalName

List of usage examples for java.lang Class getCanonicalName

Introduction

In this page you can find the example usage for java.lang Class getCanonicalName.

Prototype

public String getCanonicalName() 

Source Link

Document

Returns the canonical name of the underlying class as defined by the Java Language Specification.

Usage

From source file:com.feilong.commons.core.lang.ClassUtil.java

/**
 *  class info map for log./*from ww  w . j a va2  s  . c o  m*/
 *
 * @param klass
 *            the clz
 * @return the map for log
 */
public static Map<String, Object> getClassInfoMapForLog(Class<?> klass) {

    Map<String, Object> map = new LinkedHashMap<String, Object>();

    //"clz.getCanonicalName()": "com.feilong.commons.core.date.DatePattern",
    //"clz.getName()": "com.feilong.commons.core.date.DatePattern",
    //"clz.getSimpleName()": "DatePattern",

    // getCanonicalName ( Java Language Specification ??) && getName
    //??class?array?
    // getName[[Ljava.lang.String?getCanonicalName?
    map.put("clz.getCanonicalName()", klass.getCanonicalName());
    map.put("clz.getName()", klass.getName());
    map.put("clz.getSimpleName()", klass.getSimpleName());

    map.put("clz.getComponentType()", klass.getComponentType());
    // ?? voidboolean?byte?char?short?int?long?float  double?
    map.put("clz.isPrimitive()", klass.isPrimitive());

    // ??,
    map.put("clz.isLocalClass()", klass.isLocalClass());
    // ????,??????
    map.put("clz.isMemberClass()", klass.isMemberClass());

    //isSynthetic()?Class????java??false?trueJVM???java??????
    map.put("clz.isSynthetic()", klass.isSynthetic());
    map.put("clz.isArray()", klass.isArray());
    map.put("clz.isAnnotation()", klass.isAnnotation());

    //??true
    map.put("clz.isAnonymousClass()", klass.isAnonymousClass());
    map.put("clz.isEnum()", klass.isEnum());

    return map;
    //      Class<?> klass = this.getClass();
    //
    //      TypeVariable<?>[] typeParameters = klass.getTypeParameters();
    //      TypeVariable<?> typeVariable = typeParameters[0];
    //
    //      Type[] bounds = typeVariable.getBounds();
    //
    //      Type bound = bounds[0];
    //
    //      if (log.isDebugEnabled()){
    //         log.debug("" + (bound instanceof ParameterizedType));
    //      }
    //
    //      Class<T> modelClass = ReflectUtil.getGenericModelClass(klass);
    //      return modelClass;
}

From source file:com.simiacryptus.util.io.MarkdownNotebookOutput.java

/**
 * Get markdown notebook output./*from ww  w .j  a v  a 2 s .  c  om*/
 *
 * @param sourceClass the source class
 * @param absoluteUrl the absolute url
 * @param suffix      the suffix
 * @return the markdown notebook output
 */
@javax.annotation.Nonnull
public static com.simiacryptus.util.io.MarkdownNotebookOutput get(
        @javax.annotation.Nonnull Class<?> sourceClass, @Nullable String absoluteUrl,
        @javax.annotation.Nonnull String... suffix) {
    try {
        final StackTraceElement callingFrame = Thread.currentThread().getStackTrace()[2];
        final String methodName = callingFrame.getMethodName();
        final String className = sourceClass.getCanonicalName();
        @javax.annotation.Nonnull
        File path = new File(Util.mkString(File.separator, "reports",
                className.replaceAll("\\.", "/").replaceAll("\\$", "/")));
        for (int i = 0; i < suffix.length - 1; i++)
            path = new File(path, suffix[i]);
        String testName = suffix.length == 0 ? methodName : suffix[suffix.length - 1];
        path = new File(path, testName + ".md");
        path.getParentFile().mkdirs();
        @javax.annotation.Nonnull
        com.simiacryptus.util.io.MarkdownNotebookOutput notebookOutput = new com.simiacryptus.util.io.MarkdownNotebookOutput(
                path, testName);
        if (null != absoluteUrl) {
            try {
                String url = new URI(absoluteUrl + "/" + path.toPath().toString().replaceAll("\\\\", "/"))
                        .normalize().toString();
                notebookOutput.setAbsoluteUrl(url);
            } catch (URISyntaxException e) {
                throw new RuntimeException(e);
            }
        }
        return notebookOutput;
    } catch (@javax.annotation.Nonnull final FileNotFoundException e) {
        throw new RuntimeException(e);
    }
}

From source file:com.sunchenbin.store.feilong.core.lang.EnumUtil.java

/**
 * fieldName value ./*from  w ww.j  av  a 2s  .c  o m*/
 * 
 * <pre>
 * 
 * ?{@link HttpMethodType} ,?:
 * 
 * {@code
 *  EnumUtil.getEnumByField(HttpMethodType.class, "method", "get")
 * }
 * </pre>
 *
 * @param <E>
 *            the element type
 * @param <T>
 *            the generic type
 * @param enumClass
 *            the enum class  {@link HttpMethodType}
 * @param propertyName
 *            ??, {@link HttpMethodType}method,javabean 
 * @param specifiedValue
 *             post
 * @param ignoreCase
 *            ??
 * @return  enum constant
 * @see com.sunchenbin.store.feilong.core.bean.BeanUtil#getProperty(Object, String)
 * @since 1.0.8
 */
private static <E extends Enum<?>, T> E getEnumByPropertyValue(Class<E> enumClass, String propertyName,
        T specifiedValue, boolean ignoreCase) {

    if (Validator.isNullOrEmpty(enumClass)) {
        throw new IllegalArgumentException("enumClass is null or empty!");
    }

    if (Validator.isNullOrEmpty(propertyName)) {
        throw new IllegalArgumentException("the fieldName is null or empty!");
    }

    // An enum is a kind of class
    // An annotation is a kind of interface
    //  Class ?, null.
    E[] enumConstants = enumClass.getEnumConstants();

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("enumClass:[{}],enumConstants:{}", enumClass.getCanonicalName(),
                JsonUtil.format(enumConstants));
    }
    for (E e : enumConstants) {
        Object propertyValue = PropertyUtil.getProperty(e, propertyName);
        if (isEquals(propertyValue, specifiedValue, ignoreCase)) {
            return e;
        }
    }
    String messagePattern = "can not found the enum constants,enumClass:[{}],propertyName:[{}],value:[{}],ignoreCase:[{}]";
    throw new BeanUtilException(
            Slf4jUtil.formatMessage(messagePattern, enumClass, propertyName, specifiedValue, ignoreCase));
}

From source file:com.spotify.heroic.shell.Tasks.java

public static List<String> allNames(final Class<? extends ShellTask> task) {
    final TaskName n = task.getAnnotation(TaskName.class);
    final List<String> names = new ArrayList<>();

    if (n != null) {
        names.add(n.value());/*from ww w.j  a va2  s .c om*/

        for (final String alias : n.aliases()) {
            names.add(alias);
        }
    }

    if (names.isEmpty()) {
        throw new IllegalStateException(
                String.format("No name configured with @TaskName on %s", task.getCanonicalName()));
    }

    return names;
}

From source file:com.unboundid.scim2.common.utils.SchemaUtils.java

/**
 * Gets the schema urn from a java <code>Class</code>.
 * @param cls <code>Class</code> of the object.
 * @return The schema urn for the object.
 *///from www  . j  av a  2 s  .c  om
public static String getSchemaUrn(final Class cls) {
    // the schemaid is the urn.  Just make sure it
    // begins with urn: ... the field called name
    // is just a human friendly name for the object.
    String schemaId = SchemaUtils.getSchemaIdFromAnnotation(cls);

    if ((schemaId == null) || (schemaId.isEmpty())) {
        schemaId = cls.getCanonicalName();
    }

    // if this doesn't appear to be a urn, stick the "urn:" prefix
    // on it, and use it as a urn anyway.
    return forceToBeUrn(schemaId);
}

From source file:com.mani.cucumber.ReflectionUtils.java

private static <T> Constructor<T> findConstructor(Class<T> clazz, Object[] params) {

    for (Constructor<?> constructor : clazz.getConstructors()) {
        Class<?>[] paramTypes = constructor.getParameterTypes();
        if (matches(paramTypes, params)) {
            @SuppressWarnings("unchecked")
            Constructor<T> rval = (Constructor<T>) constructor;
            return rval;
        }/*from   w ww. j  ava  2  s .  c om*/
    }

    throw new IllegalStateException("No appropriate constructor found for " + clazz.getCanonicalName());
}

From source file:org.web4thejob.util.CoreUtil.java

public static Map<String, String> getRelatedPanelsMap(Class<? extends Entity> entityType,
        Class<? extends ContentPanel> panelType) {

    Map<String, Object> tags = new HashMap<String, Object>();

    if (panelType != null) {
        if (EntityViewPanel.class.isAssignableFrom(panelType)) {
            tags.put(CoreUtil.TAG_ENTITY_VIEW, true);
        } else if (ListViewPanel.class.isAssignableFrom(panelType)) {
            tags.put(CoreUtil.TAG_LIST_VIEW, true);
        } else {/*from  w  ww .  j a v  a 2 s.  c om*/
            throw new UnsupportedOperationException(
                    "panel type not supported yet:" + panelType.getCanonicalName());
        }
    }

    if (entityType != null) {
        tags.put(SettingEnum.TARGET_TYPE.name(), entityType.getCanonicalName());
    }

    tags.put(CoreUtil.TAG_MASTER_DETAIL, false);

    List<PanelDefinition> panelDefinitions = ORMUtil.getPanelsMatchingTags(tags);
    if (panelDefinitions.isEmpty())
        return Collections.emptyMap();

    Map<String, String> map = new LinkedHashMap<String, String>(panelDefinitions.size());
    for (PanelDefinition panelDefinition : ORMUtil.getPanelsMatchingTags(tags)) {
        map.put(panelDefinition.getBeanId(), panelDefinition.getName());
    }

    return map;

}

From source file:com.github.abel533.mapperhelper.EntityHelper.java

/**
 * map?bean// w w w .  jav  a2s.  c  o  m
 *
 * @param map
 * @param beanClass
 * @return
 */
public static Object map2Bean(Map<String, Object> map, Class<?> beanClass) {
    try {
        if (map == null) {
            return null;
        }
        Map<String, Object> aliasMap = map2AliasMap(map, beanClass);
        Object bean = beanClass.newInstance();
        BeanUtils.copyProperties(bean, aliasMap);
        return bean;
    } catch (InstantiationException e) {
        throw new RuntimeException(beanClass.getCanonicalName() + "!");
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

From source file:org.web4thejob.web.util.ZkUtil.java

public static void addBinding(DataBinder dataBinder, Component component, String beanId, String propertyPath,
        Class<? extends TypeConverter> typeConverter) {

    String converterName = null;//from   w  w  w . j  a v a  2s .c  o  m
    if (typeConverter != null) {
        converterName = typeConverter.getCanonicalName();
    }

    propertyPath = beanId + (StringUtils.hasText(propertyPath) ? "." + propertyPath : "");

    if (component instanceof PropertyBox) {
        dataBinder.addBinding(component, "entity", beanId, (String[]) null, (String[]) null, "load",
                converterName);
    } else if (component instanceof Html) {
        dataBinder.addBinding(component, "content", propertyPath, (String[]) null, (String[]) null, null,
                converterName);
    } else if (component instanceof Iframe || component instanceof Image) {
        dataBinder.addBinding(component, "content", propertyPath, (String[]) null, (String[]) null, null,
                converterName);
    } else if (component instanceof Checkbox) {
        dataBinder.addBinding(component, "checked", propertyPath, (String[]) null, (String[]) null, null,
                converterName);
    } else if (component instanceof Combobox) {
        final String[] loadWhen = { Events.ON_CHANGE, Events.ON_SELECT };
        final String saveWhen = Events.ON_CHANGE;
        final String access = "both";
        dataBinder.addBinding(component, "selectedItem", propertyPath, loadWhen, saveWhen, access,
                converterName);
    } else if (component instanceof RawValueBox) {
        final String[] loadWhen = { Events.ON_CHANGE };
        final String saveWhen = Events.ON_CHANGE;
        final String access = "both";
        dataBinder.addBinding(component, "rawValue", propertyPath, loadWhen, saveWhen, access, converterName);
    } else if (component instanceof InputElement) {
        dataBinder.addBinding(component, "value", propertyPath, (String[]) null, (String[]) null, null,
                converterName);
    } else if (component instanceof Label) {
        dataBinder.addBinding(component, "value", propertyPath, (String[]) null, (String[]) null, null,
                converterName);
    } else {
        throw new IllegalArgumentException("cannot bind " + component.toString());
    }

    // special case for password encyption
    if (component instanceof PasswordEditor) {
        dataBinder.addBinding(component, "userIdentity", beanId, (String[]) null, (String[]) null, null,
                converterName);
    }

}

From source file:com.lucidtechnics.blackboard.TargetConstructor.java

private static final byte[] createWrapperObjectByteArray(String _targetName, Class _class) {
    ClassWriter classWriter = new ClassWriter(true);

    FieldVisitor fieldVisitor;/*  w  w w.j  av  a2s.  c  om*/
    MethodVisitor methodVisitor;
    String superClassName = _class.getCanonicalName().replaceAll("\\.", "/");

    String[] superClassNameParts = superClassName.split("/");
    String simpleClassName = superClassNameParts[superClassNameParts.length - 1];
    String blackboardSubClassName = "com/lucidtechnics/blackboard/wrapper/" + superClassName + "Wrapper";

    classWriter.visit(Opcodes.V1_5, Opcodes.ACC_PUBLIC + Opcodes.ACC_SUPER, blackboardSubClassName, null,
            superClassName, new String[] { "com/lucidtechnics/blackboard/Target" });

    classWriter.visitSource(simpleClassName, null);

    {
        fieldVisitor = classWriter.visitField(Opcodes.ACC_PRIVATE, "blackboardObject", "Ljava/lang/Object;",
                null, null);
        fieldVisitor.visitEnd();
    }

    {
        fieldVisitor = classWriter.visitField(Opcodes.ACC_PRIVATE, "intercepter",
                "Lcom/lucidtechnics/blackboard/Intercepter;", null, null);
        fieldVisitor.visitEnd();
    }

    {
        methodVisitor = classWriter.visitMethod(Opcodes.ACC_PUBLIC, "getBlackboardObject",
                "()Ljava/lang/Object;", null, null);
        methodVisitor.visitCode();
        methodVisitor.visitVarInsn(Opcodes.ALOAD, 0);
        methodVisitor.visitFieldInsn(Opcodes.GETFIELD, blackboardSubClassName, "blackboardObject",
                "Ljava/lang/Object;");
        methodVisitor.visitInsn(Opcodes.ARETURN);
        methodVisitor.visitMaxs(0, 0);
        methodVisitor.visitEnd();
    }

    {
        methodVisitor = classWriter.visitMethod(Opcodes.ACC_PUBLIC, "getIntercepter",
                "()Lcom/lucidtechnics/blackboard/Intercepter;", null, null);
        methodVisitor.visitCode();
        methodVisitor.visitVarInsn(Opcodes.ALOAD, 0);
        methodVisitor.visitFieldInsn(Opcodes.GETFIELD, blackboardSubClassName, "intercepter",
                "Lcom/lucidtechnics/blackboard/Intercepter;");
        methodVisitor.visitInsn(Opcodes.ARETURN);
        methodVisitor.visitMaxs(0, 0);
        methodVisitor.visitEnd();
    }

    {
        methodVisitor = classWriter.visitMethod(Opcodes.ACC_PUBLIC, "setBlackboardObject",
                "(Ljava/lang/Object;)V", null, null);
        methodVisitor.visitCode();
        methodVisitor.visitVarInsn(Opcodes.ALOAD, 0);
        methodVisitor.visitVarInsn(Opcodes.ALOAD, 1);
        methodVisitor.visitFieldInsn(Opcodes.PUTFIELD, blackboardSubClassName, "blackboardObject",
                "Ljava/lang/Object;");
        methodVisitor.visitInsn(Opcodes.RETURN);
        methodVisitor.visitMaxs(0, 0);
        methodVisitor.visitEnd();
    }

    {
        methodVisitor = classWriter.visitMethod(Opcodes.ACC_PUBLIC, "setIntercepter",
                "(Lcom/lucidtechnics/blackboard/Intercepter;)V", null, null);
        methodVisitor.visitCode();
        methodVisitor.visitVarInsn(Opcodes.ALOAD, 0);
        methodVisitor.visitVarInsn(Opcodes.ALOAD, 1);
        methodVisitor.visitFieldInsn(Opcodes.PUTFIELD, blackboardSubClassName, "intercepter",
                "Lcom/lucidtechnics/blackboard/Intercepter;");
        methodVisitor.visitInsn(Opcodes.RETURN);
        methodVisitor.visitMaxs(0, 0);
        methodVisitor.visitEnd();
    }

    {
        methodVisitor = classWriter.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null);
        methodVisitor.visitCode();
        methodVisitor.visitVarInsn(Opcodes.ALOAD, 0);
        methodVisitor.visitMethodInsn(Opcodes.INVOKESPECIAL, superClassName, "<init>", "()V");
        methodVisitor.visitInsn(Opcodes.RETURN);
        methodVisitor.visitMaxs(0, 0);
        methodVisitor.visitEnd();
    }

    List mutatorMethodList = findMutatorMethods(_class);

    Iterator mutatorMethods = mutatorMethodList.iterator();

    while (mutatorMethods.hasNext() == true) {
        Method method = (Method) mutatorMethods.next();
        MethodInfo methodInfo = (MethodInfo) MethodInfoTransformer.getInstance().transform(method);
        Signature signature = methodInfo.getSignature();
        String methodName = signature.getName();

        String parameterType = signature.getArgumentTypes()[0].getDescriptor();
        String returnType = signature.getReturnType().getDescriptor();
        String[] exceptionTypeArray = createExceptionTypeArray(methodInfo.getExceptionTypes());

        {
            methodVisitor = classWriter.visitMethod(Opcodes.ACC_PUBLIC, methodName,
                    "(" + parameterType + ")" + returnType, null, exceptionTypeArray);

            methodVisitor.visitVarInsn(Opcodes.ALOAD, 0);
            methodVisitor.visitMethodInsn(Opcodes.INVOKEVIRTUAL, blackboardSubClassName, "getIntercepter",
                    "()Lcom/lucidtechnics/blackboard/Intercepter;");
            Label l1 = new Label();
            methodVisitor.visitJumpInsn(Opcodes.IFNULL, l1);

            methodVisitor.visitCode();
            methodVisitor.visitVarInsn(Opcodes.ALOAD, 0);
            methodVisitor.visitMethodInsn(Opcodes.INVOKEVIRTUAL, blackboardSubClassName, "getIntercepter",
                    "()Lcom/lucidtechnics/blackboard/Intercepter;");

            methodVisitor.visitLdcInsn(superClassName);
            methodVisitor.visitLdcInsn(blackboardSubClassName);
            methodVisitor.visitLdcInsn(methodName);
            methodVisitor.visitLdcInsn(_targetName);
            methodVisitor.visitVarInsn(Opcodes.ALOAD, 0);

            int tempOpCode = getLoadOpcode(parameterType);
            methodVisitor.visitVarInsn(tempOpCode, 1);

            if (tempOpCode == Opcodes.ALOAD) {
                //this is an object.
                methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE,
                        "com/lucidtechnics/blackboard/Intercepter", "monitor",
                        "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V");
            } else {
                //it is a primitive.
                methodVisitor.visitMethodInsn(Opcodes.INVOKEINTERFACE,
                        "com/lucidtechnics/blackboard/Intercepter", "monitor",
                        "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;"
                                + parameterType + ")V");
            }

            methodVisitor.visitVarInsn(Opcodes.ALOAD, 0);
            methodVisitor.visitMethodInsn(Opcodes.INVOKEVIRTUAL, blackboardSubClassName, "getBlackboardObject",
                    "()Ljava/lang/Object;");
            methodVisitor.visitTypeInsn(Opcodes.CHECKCAST, superClassName);
            methodVisitor.visitVarInsn(getLoadOpcode(parameterType), 1);
            methodVisitor.visitMethodInsn(Opcodes.INVOKEVIRTUAL, superClassName, methodName,
                    "(" + parameterType + ")" + returnType);

            methodVisitor.visitLabel(l1);

            methodVisitor.visitInsn(getReturnOpcode(returnType));
            methodVisitor.visitMaxs(0, 0);
            methodVisitor.visitEnd();
        }
    }

    List otherPublicMethodList = findOtherPublicMethods(_class);

    Iterator otherPublicMethods = otherPublicMethodList.iterator();

    while (otherPublicMethods.hasNext() == true) {
        Method method = (Method) otherPublicMethods.next();
        MethodInfo methodInfo = (MethodInfo) MethodInfoTransformer.getInstance().transform(method);
        Signature signature = methodInfo.getSignature();
        String methodName = signature.getName();

        String parameterTypes = constructParameterTypes(signature.getArgumentTypes());
        String returnType = signature.getReturnType().getDescriptor();
        String[] exceptionTypeArray = createExceptionTypeArray(methodInfo.getExceptionTypes());

        if (logger.isDebugEnabled() == true) {
            logger.debug("Processing method: " + methodName);
        }
        if (logger.isDebugEnabled() == true) {
            logger.debug("Parameter types are: " + parameterTypes);
        }

        if ("toString".equalsIgnoreCase(methodName) == false) {
            methodVisitor = classWriter.visitMethod(Opcodes.ACC_PUBLIC, methodName,
                    "(" + parameterTypes + ")" + returnType, null, exceptionTypeArray);

            methodVisitor.visitCode();
            methodVisitor.visitVarInsn(Opcodes.ALOAD, 0);
            methodVisitor.visitMethodInsn(Opcodes.INVOKEVIRTUAL, blackboardSubClassName, "getBlackboardObject",
                    "()Ljava/lang/Object;");
            methodVisitor.visitTypeInsn(Opcodes.CHECKCAST, superClassName);
            methodVisitor.visitVarInsn(Opcodes.ASTORE, signature.getArgumentTypes().length + 1);
            methodVisitor.visitVarInsn(Opcodes.ALOAD, signature.getArgumentTypes().length + 1);

            loadParameters(methodVisitor, signature.getArgumentTypes());

            methodVisitor.visitMethodInsn(Opcodes.INVOKEVIRTUAL, superClassName, methodName,
                    "(" + parameterTypes + ")" + returnType);
            methodVisitor.visitInsn(getReturnOpcode(returnType));
            methodVisitor.visitMaxs(0, 0);
            methodVisitor.visitEnd();
        }
    }

    List protectedMethodList = findProtectedMethods(_class);

    Iterator protectedMethods = protectedMethodList.iterator();

    while (protectedMethods.hasNext() == true) {
        Method method = (Method) protectedMethods.next();
        MethodInfo methodInfo = (MethodInfo) MethodInfoTransformer.getInstance().transform(method);
        Signature signature = methodInfo.getSignature();
        String methodName = signature.getName();

        String parameterTypes = constructParameterTypes(signature.getArgumentTypes());
        String returnType = signature.getReturnType().getDescriptor();
        String[] exceptionTypeArray = createExceptionTypeArray(methodInfo.getExceptionTypes());

        if (logger.isDebugEnabled() == true) {
            logger.debug("Processing method: " + methodName + " and parameter types are: " + parameterTypes);
        }

        {
            methodVisitor = classWriter.visitMethod(Opcodes.ACC_PROTECTED, methodName,
                    "(" + parameterTypes + ")" + returnType, null, exceptionTypeArray);

            methodVisitor.visitCode();
            methodVisitor.visitTypeInsn(Opcodes.NEW, "com/lucidtechnics/blackboard/BlackboardException");
            methodVisitor.visitInsn(Opcodes.DUP);
            methodVisitor.visitLdcInsn("Unable to access protected methods on Blackboard object");
            methodVisitor.visitMethodInsn(Opcodes.INVOKESPECIAL,
                    "com/lucidtechnics/blackboard/BlackboardException", "<init>", "(Ljava/lang/String;)V");
            methodVisitor.visitInsn(Opcodes.ATHROW);
            methodVisitor.visitMaxs(0, 0);
            methodVisitor.visitEnd();
        }
    }

    {
        methodVisitor = classWriter.visitMethod(Opcodes.ACC_PUBLIC, "toString", "()Ljava/lang/String;", null,
                null);
        methodVisitor.visitCode();
        methodVisitor.visitVarInsn(Opcodes.ALOAD, 0);
        methodVisitor.visitMethodInsn(Opcodes.INVOKEVIRTUAL, blackboardSubClassName, "getBlackboardObject",
                "()Ljava/lang/Object;");
        methodVisitor.visitMethodInsn(Opcodes.INVOKESTATIC, "com/lucidtechnics/blackboard/util/Utility",
                "toString", "(Ljava/lang/Object;)Ljava/lang/String;");
        methodVisitor.visitInsn(getReturnOpcode("Ljava/lang/String;"));
        methodVisitor.visitMaxs(0, 0);
        methodVisitor.visitEnd();
    }

    classWriter.visitEnd();

    if (logger.isDebugEnabled() == true) {
        logger.debug("Finished creating new class: " + blackboardSubClassName + " for target class: "
                + superClassName + ".");
    }

    return classWriter.toByteArray();
}