This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have a list of beans stored in an ArrayList and I'm iterating the list to get each bean out of it. I have a String value to be checked inside the bean. I don't know what the field name of the String value to search in the bean. For eg: The bean might have some three fields say AA, BB, CC.
My string value might be matching to bean.getAA()/bean.getBB() or bean.getCC(). Now, since I don't know the name of the fields inside the bean, I cannot use getter methods.
I just stored this bean object to a Collection reference and executed a reference.contains(String value). But, I'm not sure this method is going to check the value.
Let me know if my solution would work fine or any other thoughts/comments.