Class EventWrapperFactory<T>
- java.lang.Object
-
- sk.ipesoft.d2000.d2japi.annotations.EventWrapperFactory<T>
-
- Type Parameters:
T- annotated type of user-defined handler
public class EventWrapperFactory<T> extends java.lang.ObjectFactory class for creating and registering "EventWrapper" objects within a JAPI Sessions.EventWrapper is object that wraps user-defined handler annotated with annotations from
sk.ipesoft.d2000.d2japi.annotations.eventBindingpackage. It is registered in JAPI Session for handling incoming RPC and SBA calls and it transforms them into calls to user-defined handler.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> EventWrapperFactory<T>createFactory(java.lang.Class<T> type, D2Session session)Create new EventWrapperFactory instance for annotatedTtype.static <T> EventWrapperFactory<T>createFactory(java.lang.Class<T> type, D2Session session, UnivalConvertor convertor)Create new EventWrapperFactory instance for annotatedTtype.voidregisterNewHandler(D2Session session, T handler)Create new instance of EventWrapper and register it insessionfor handling incoming RPC and SBA calls.
-
-
-
Method Detail
-
createFactory
public static <T> EventWrapperFactory<T> createFactory(java.lang.Class<T> type, D2Session session) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
Create new EventWrapperFactory instance for annotatedTtype. Use default instance ofUnivalConvertorofsession's connector.- Type Parameters:
T- annotated type of user-defined handler- Parameters:
type- Reference toTtypesession- connected JAPI Session object used for resolving D2000 names to HOBJ. It can be different than one passed toregisterNewHandler(D2Session, Object)method, but MUST be connected to the same D2000 kernel.- Returns:
- new instance of EventWrapperFactory
- Throws:
java.util.concurrent.ExecutionException- throw when error occurs during name resolutionjava.lang.InterruptedException- thrown when interrupted during waiting for result of JAPI Session requestsjava.lang.IllegalArgumentException- whentypeis annotated incorrectly
-
createFactory
public static <T> EventWrapperFactory<T> createFactory(java.lang.Class<T> type, D2Session session, UnivalConvertor convertor) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
Create new EventWrapperFactory instance for annotatedTtype. Use custom instance ofUnivalConvertor.- Type Parameters:
T- annotated type of user-defined handler- Parameters:
type- Reference toTtypesession- connected JAPI Session object used for resolving D2000 names to HOBJ. It can be different than one passed toregisterNewHandler(D2Session, Object)method, but MUST be connected to the same D2000 kernel.convertor- instance of UnivalConvertor, could be shared by several factories to improve performance- Returns:
- new instance of EventWrapperFactory
- Throws:
java.util.concurrent.ExecutionException- throw when error occurs during name resolutionjava.lang.InterruptedException- thrown when interrupted during waiting for result of JAPI Session requestsjava.lang.IllegalArgumentException- whentypeis annotated incorrectly
-
-