首页 > 代码库 > beanutils中WrapDynaBean

beanutils中WrapDynaBean

public class Emp   {

    private String  firstName="李";
    private String lastName;
    public Emp() {
    } ;  
    
     public String getFirstName() {
        return firstName;
    }
     public void setFirstName(String firstName) {
         this.firstName=firstName;
     }
     public String getLastName() {
        return lastName;
    }
     public void setLastName(String lastName){
         this.lastName=lastName;
     }
     private Date hireDate;
     public Date getHireDate(){
         return hireDate;
     }
     public void setHireDate(Date hireDate){
         this.hireDate=hireDate;
     }
     private boolean manager;
     public boolean isManager(){
         return manager;
     }
     public void setManager(boolean manager){
         this.manager=manager;
     }
     public String getFullName(){
         return lastName+firstName;
     }
     
     public Emp getEmployee(int index) {
        return new Emp();
    }
     //private Address address;
     public Address getAddress(String home) {
        return new Address();
    }
//     public void setAddress(Address address) {
//         System.out.println(address);
//        this.address=address;
//    }

}

 

public class WarDynaClassTest {

    public static void main(String[] args) {
        Emp emp=new Emp();
        DynaBean war=new WrapDynaBean(emp);
        System.out.println(war.get("firstName"));
    }

}

beanutils中WrapDynaBean