public static void main(String a[]) throws IllegalArgumentException,
			IllegalAccessException {
		Role role = new Role();
		role.setName("aa");
		role.setType("type1");
		role.setId("id1");
		Class c = role.getClass();
		Field fields1[] = c.getFields();
		for (int i = 0; i < fields1.length; i++) {
			System.out.println("һαԱ" + fields1[i].getName() + "  :"
					+ fields1[i].getType());
			System.out.println(fields1[i].getModifiers());// 1Ǳʾpublic 2
															// Ǳʾprivate
			System.out.println("ֵΪ:" + fields1[i].get(role));
		}

		Field fields2[] = c.getDeclaredFields();
		
		for (int i = 0; i < fields2.length; i++) {
			System.out.println("ڶαԱ" + fields2[i].getName() + "  :"
					+ fields2[i].getType()+"  private or public :"+fields2[i].getModifiers());
			
			// System.out.println(fields2[i].getDeclaringClass());
			// System.out.println(fields2[i].getGenericType());
			try {
				System.out.println("ֵΪ:" + fields2[i].get(role));// ǻᷢ˽гԱǲʵ
			} catch (Exception e) {
				// TODO: handle exception
				System.out.println("ûȨ޵ʱǲԷ˽гԱ");
			}
		
		}
		Field.setAccessible(fields2, true);// ȨΪtrueǲܽȥ
		for (int i = 0; i < fields2.length; i++) {
			System.out.println("αԱ" + fields2[i].getName() + "  :"
					+ fields2[i].getType()+"  ˽лpublic:"+fields2[i].getModifiers());
			System.out.println("޸ǰֵΪ:" + fields2[i].get(role));
			
             fields2[i].set(role, "fixed");
			System.out.println("޸ĺֵΪ:" + fields2[i].get(role));// ǻᷢ˽гԱǲʵ
		}

	}