]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/StaticMethodAdapter.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.db.services / src / org / simantics / db / services / adaption / reflection / StaticMethodAdapter.java
index fa131a818fb289b2123cf1eae42e9d3fa846d064..33d6139bece759356fa95ca53a2356f2863728c7 100644 (file)
@@ -1,55 +1,55 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.db.services.adaption.reflection;\r
-\r
-import java.lang.reflect.InvocationTargetException;\r
-import java.lang.reflect.Method;\r
-\r
-import org.simantics.db.AsyncReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.procedure.AsyncProcedure;\r
-\r
-public class StaticMethodAdapter<T> extends AbstractReflectionAdapter<T> {\r
-\r
-       Method constructor;\r
-       \r
-       public StaticMethodAdapter(Class<? extends T> clazz, String methodName, IDynamicAdapter2 ... parameters) throws SecurityException, NoSuchMethodException, DatabaseException {\r
-           super(parameters);      \r
-               Class<?>[] parameterTypes = new Class<?>[parameters.length];\r
-               for(int i=0;i<parameters.length;++i)\r
-                       parameterTypes[i] = parameters[i].getType();\r
-               this.constructor = clazz.getMethod(methodName, parameterTypes);\r
-       }\r
-       \r
-       @SuppressWarnings("unchecked")\r
-    @Override\r
-       public void construct(AsyncReadGraph g, AsyncProcedure<T> procedure, Object ... args) {\r
-           try {\r
-            procedure.execute(g, (T)constructor.invoke(null, args));\r
-        } catch (IllegalArgumentException e) {\r
-            procedure.exception(g, e);\r
-            e.printStackTrace();\r
-        } catch (IllegalAccessException e) {\r
-            procedure.exception(g, e);\r
-            e.printStackTrace();\r
-        } catch (InvocationTargetException e) {\r
-            procedure.exception(g, e.getCause());\r
-            e.getCause().printStackTrace();\r
-        }\r
-       }\r
-           \r
-    @Override\r
-    public String toString() {\r
-        return "ReflectionAdapter for " + constructor.getName();\r
-    }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.db.services.adaption.reflection;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.simantics.db.AsyncReadGraph;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.procedure.AsyncProcedure;
+
+public class StaticMethodAdapter<T> extends AbstractReflectionAdapter<T> {
+
+       Method constructor;
+       
+       public StaticMethodAdapter(Class<? extends T> clazz, String methodName, IDynamicAdapter2 ... parameters) throws SecurityException, NoSuchMethodException, DatabaseException {
+           super(parameters);      
+               Class<?>[] parameterTypes = new Class<?>[parameters.length];
+               for(int i=0;i<parameters.length;++i)
+                       parameterTypes[i] = parameters[i].getType();
+               this.constructor = clazz.getMethod(methodName, parameterTypes);
+       }
+       
+       @SuppressWarnings("unchecked")
+    @Override
+       public void construct(AsyncReadGraph g, AsyncProcedure<T> procedure, Object ... args) {
+           try {
+            procedure.execute(g, (T)constructor.invoke(null, args));
+        } catch (IllegalArgumentException e) {
+            procedure.exception(g, e);
+            e.printStackTrace();
+        } catch (IllegalAccessException e) {
+            procedure.exception(g, e);
+            e.printStackTrace();
+        } catch (InvocationTargetException e) {
+            procedure.exception(g, e.getCause());
+            e.getCause().printStackTrace();
+        }
+       }
+           
+    @Override
+    public String toString() {
+        return "ReflectionAdapter for " + constructor.getName();
+    }
+
+}