Package cl.molavec.reflection

Source Code of cl.molavec.reflection.ReflectionTests

package cl.molavec.reflection;

import java.lang.reflect.InvocationTargetException;

import org.apache.commons.beanutils.PropertyUtils;
import org.junit.Test;

import cl.molavec.jpa.entities.QUser;

/**
* Utilización de org.apache.commons.beanutils.PropertyUtils 
*
* @author angel
*
*
*/

public class ReflectionTests {

  @Test
    public void insertDummyData() throws
                    IllegalAccessException,
                    InvocationTargetException,
                    NoSuchMethodException,
                    InstantiationException {
    QUser quser =  new QUser();
    quser.setUsername("username1");
    String o1 = (String) PropertyUtils.getSimpleProperty(quser, "username");
    System.out.println(o1);
   
    QUser quser2 =  QUser.class.newInstance();
    quser.setUsername("username2");
    String o2 = (String) PropertyUtils.getSimpleProperty(quser, "username");
    System.out.println(o2);
  }

}
TOP

Related Classes of cl.molavec.reflection.ReflectionTests

TOP
Copyright © 2018 www.massapi.com. 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.