1、pojo类
package net.gtja.ldap;
public class Dept {
private String ldapUserName ;
private String userName ;
private String phoneNum ;
private String email ;
private int deviceNum ;
private int groupId ;
private String groupName ;
private String groupLevel ;
private int parentGroupID ;
public String getLdapUserName() {
return ldapUserName;
}
public void setLdapUserName(String ldapUserName) {
this.ldapUserName = ldapUserName;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPhoneNum() {
return phoneNum;
}
public void setPhoneNum(String phoneNum) {
this.phoneNum = phoneNum;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getDeviceNum() {
return deviceNum;
}
public void setDeviceNum(int deviceNum) {
this.deviceNum = deviceNum;
}
public int getGroupId() {
return groupId;
}
public void setGroupId(int groupId) {
this.groupId = groupId;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public String getGroupLevel() {
return groupLevel;
}
public void setGroupLevel(String groupLevel) {
this.groupLevel = groupLevel;
}
public int getParentGroupID() {
return parentGroupID;
}
public void setParentGroupID(int parentGroupID) {
this.parentGroupID = parentGroupID;
}
}
2、通过反射执行Dept中的所有get方法
package net.gtja.ldap;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class T {
/**
* @param args
* @throws NoSuchMethodException
* @throws SecurityException
* @throws InvocationTargetException
* @throws IllegalAccessException
* @throws IllegalArgumentException