Commit | Line | Data |
---|---|---|
1efa4016 MS |
1 | /* |
2 | * To change this template, choose Tools | Templates | |
3 | * and open the template in the editor. | |
4 | */ | |
5 | package org.ufcspa.simdecs.diagram.util; | |
6 | ||
7 | import com.sun.xml.internal.ws.util.StringUtils; | |
8 | import java.lang.reflect.Field; | |
9 | import java.lang.reflect.Method; | |
10 | ||
11 | /** | |
12 | * | |
13 | * @author maroni | |
14 | */ | |
15 | public class ReflectionUtils { | |
16 | ||
17 | ||
18 | public static Method getSetterMethod(Class reflectClass, Field field) { | |
19 | for (Method method : reflectClass.getMethods()) { | |
20 | if (method.getName().equals("set" + StringUtils.capitalize(field.getName()))) { | |
21 | return method; | |
22 | } | |
23 | } | |
24 | ||
25 | return null; | |
26 | } | |
27 | ||
28 | public static Method getGetterMethod(Class reflectClass, Field field) { | |
29 | for (Method method : reflectClass.getMethods()) { | |
30 | if (method.getName().equals("get" + StringUtils.capitalize(field.getName()))) { | |
31 | return method; | |
32 | } | |
33 | } | |
34 | ||
35 | return null; | |
36 | } | |
37 | ||
38 | } |