Initial import for Diagrama.
[simdecs_seam.git] / Diagrama / src / java / org / ufcspa / simdecs / diagram / util / ReflectionUtils.java
diff --git a/Diagrama/src/java/org/ufcspa/simdecs/diagram/util/ReflectionUtils.java b/Diagrama/src/java/org/ufcspa/simdecs/diagram/util/ReflectionUtils.java
new file mode 100644 (file)
index 0000000..8cf93ba
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.ufcspa.simdecs.diagram.util;
+
+import com.sun.xml.internal.ws.util.StringUtils;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+/**
+ *
+ * @author maroni
+ */
+public class ReflectionUtils {
+    
+    
+    public static Method getSetterMethod(Class reflectClass, Field field) {
+        for (Method method : reflectClass.getMethods()) {
+            if (method.getName().equals("set" + StringUtils.capitalize(field.getName()))) {
+                return method;
+            }
+        }
+        
+        return null;
+    }
+
+    public static Method getGetterMethod(Class reflectClass, Field field) {
+        for (Method method : reflectClass.getMethods()) {
+            if (method.getName().equals("get" + StringUtils.capitalize(field.getName()))) {
+                return method;
+            }
+        }
+        
+        return null;
+    }
+    
+}