Created
July 3, 2015 06:34
-
-
Save eiryu/a4f134d76ddd6e13e5f2 to your computer and use it in GitHub Desktop.
org.apache.commons.beanutils.PropertyUtils
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('commons-beanutils:commons-beanutils:1.8.3') | |
import org.apache.commons.beanutils.PropertyUtils | |
def b= new Bean(); | |
b.name= 'bob' | |
b.age= 11 | |
println b | |
// Mapに詰めてくれる | |
Map<String, Object> m= PropertyUtils.describe(b) | |
println m | |
class Bean { | |
String name | |
int age | |
public String toString() { | |
return "name="+ name+ ", age="+age | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment