org.knime.core.internal
Class SerializerMethodLoader

java.lang.Object
  extended by org.knime.core.internal.SerializerMethodLoader

public final class SerializerMethodLoader
extends Object

Utility class to invoke static methods on classes to retrieve a serializer factory. This class is outsourced as it is used in different places, for instance DataType and NodePersistorVersion200

Author:
Bernd Wiswedel, University of Konstanz

Nested Class Summary
static interface SerializerMethodLoader.Serializer<T>
          Creates new static serializer object.
 
Method Summary
static
<T,V extends SerializerMethodLoader.Serializer<T>>
V
getSerializer(Class<T> encapsulatingClass, Class<V> desiredReturnType, String methodName, boolean allowSuperClass)
          Invokes a static method named methodName on class encapsulatingClass, which is supposed to have no arguments and whose return type is V<T>.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSerializer

public static <T,V extends SerializerMethodLoader.Serializer<T>> V getSerializer(Class<T> encapsulatingClass,
                                                                                 Class<V> desiredReturnType,
                                                                                 String methodName,
                                                                                 boolean allowSuperClass)
                                                                    throws NoSuchMethodException
Invokes a static method named methodName on class encapsulatingClass, which is supposed to have no arguments and whose return type is V<T>. One example is:
    DataCellSerializer<FooCell> getCellSerializer() { ... }
 
defined on class FooCell.

Type Parameters:
T - Class type, which defines the method (also the parameterized return type.
V - The inherited class of class Serializer.
Parameters:
encapsulatingClass - The class defining this method.
desiredReturnType - The expected return type, implementing interface SerializerMethodLoader.Serializer
allowSuperClass - Whether to allow the definition of the method in a super class of encapsulatingClass.
methodName - The name of the method.
Returns:
The return value of that method.
Throws:
NoSuchMethodException - If this method can't be found or invoked for any reason.


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.