daily pastebin goal
58%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. BeanUtils - 'describe' method returning Incorrect array value
  2. public class Demo {
  3.  
  4.         private ArrayList<String> myList = new ArrayList<String>();
  5.  
  6.         public Demo() {
  7.             myList.add("first_value");
  8.             myList.add("second_value");
  9.         }
  10.  
  11.         public ArrayList<String> getMyList() {
  12.             return myList;
  13.         }
  14.  
  15.         public void setMyList(ArrayList<String> myList) {
  16.             this.myList = myList;
  17.         }
  18.  
  19.         public static void main(String[] args) {
  20.             Demo myBean = new Demo();
  21.             try {
  22.                 Map describe = BeanUtils.describe(myBean);
  23.                 Iterator it = describe.entrySet().iterator();
  24.                 while (it.hasNext()) {
  25.                     Map.Entry pairs = (Map.Entry) it.next();
  26.                     System.out.println(String.format("key=%s,value=%s", (String) pairs.getKey(), (String) pairs.getValue()));
  27.  
  28.                 }
  29.             } catch (Exception e) {
  30.                 e.printStackTrace();
  31.             }
  32.         }
  33.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top