Package com.subhajit.codeanalysis

Examples of com.subhajit.codeanalysis.BeanCreator


      ClassNotFoundException, IllegalArgumentException,
      NoSuchFieldException {
    super();
    this.originalBean = bean;
    if (bean.getClass().isArray()) {
      this.bean = new BeanCreator().defineClass(
          "com.subhajit.foo.A"
              + UUID.randomUUID().toString().replace('-', 'A')
              + "A.Bean", new String[] { "elements" },
          new String[] { originalBean.getClass().getName() })
          .newInstance();
View Full Code Here


    DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode();
    // If bean is an array, we want to wrap this in a Superbean's "values"
    // field.
    if (bean != null && bean.getClass().isArray()) {
      try {
        BeanCreator c = new BeanCreator(new URLClassLoader(new URL[0],
            Thread.currentThread().getContextClassLoader()));
        Object superBean = c.defineClass(
            "com.subhajit.foo.A"
                + UUID.randomUUID().toString()
                    .replace('-', 'A') + ".tempClass",
            new String[] { "arrayElements" },
            new Class<?>[] { bean.getClass() }).newInstance();
        BeanUtils.getInstance().set(superBean, "arrayElements", bean);
        setupBean(rootNode, superBean, fieldsToEdit);
        tree.setModel(new DefaultTreeModel(rootNode));
      } catch (javax.management.ReflectionException exc) {
        throw new ReflectionException(exc);
      } catch (ClassNotFoundException e) {
        throw new ReflectionException(e);
      } catch (IOException e) {
        throw new ReflectionException(e);
      } catch (InstantiationException e) {
        throw new ReflectionException(e);
      } catch (IllegalAccessException e) {
        throw new ReflectionException(e);
      } catch (IllegalArgumentException e) {
        throw new ReflectionException(e);
      } catch (NoSuchFieldException e) {
        throw new ReflectionException(e);
      } catch (NoSuchMethodException e) {
        throw new ReflectionException(e);
      } catch (InvocationTargetException e) {
        throw new ReflectionException(e);
      }
    } else if (bean != null && List.class.isAssignableFrom(bean.getClass())) {
      try {
        BeanCreator c = new BeanCreator(new URLClassLoader(new URL[0],
            Thread.currentThread().getContextClassLoader()));
        Object superBean = c.defineClass(
            "com.swa.foo." + UUID.randomUUID().toString()
                + ".tempClass",
            new String[] { "arrayElements" },
            new Class<?>[] { bean.getClass() }).newInstance();
        try {
View Full Code Here

TOP

Related Classes of com.subhajit.codeanalysis.BeanCreator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.