X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.db.services%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fservices%2Fadaption%2Freflection%2FStaticMethodAdapter.java;h=33d6139bece759356fa95ca53a2356f2863728c7;hb=refs%2Fchanges%2F38%2F238%2F2;hp=fa131a818fb289b2123cf1eae42e9d3fa846d064;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/StaticMethodAdapter.java b/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/StaticMethodAdapter.java index fa131a818..33d6139be 100644 --- a/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/StaticMethodAdapter.java +++ b/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/StaticMethodAdapter.java @@ -1,55 +1,55 @@ -/******************************************************************************* - * 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 extends AbstractReflectionAdapter { - - Method constructor; - - public StaticMethodAdapter(Class clazz, String methodName, IDynamicAdapter2 ... parameters) throws SecurityException, NoSuchMethodException, DatabaseException { - super(parameters); - Class[] parameterTypes = new Class[parameters.length]; - for(int i=0;i 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(); - } - -} +/******************************************************************************* + * 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 extends AbstractReflectionAdapter { + + Method constructor; + + public StaticMethodAdapter(Class clazz, String methodName, IDynamicAdapter2 ... parameters) throws SecurityException, NoSuchMethodException, DatabaseException { + super(parameters); + Class[] parameterTypes = new Class[parameters.length]; + for(int i=0;i 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(); + } + +}