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.Object
Factory 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.eventBinding
package. 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 annotatedT
type.static <T> EventWrapperFactory<T>
createFactory(java.lang.Class<T> type, D2Session session, UnivalConvertor convertor)
Create new EventWrapperFactory instance for annotatedT
type.void
registerNewHandler(D2Session session, T handler)
Create new instance of EventWrapper and register it insession
for 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 annotatedT
type. Use default instance ofUnivalConvertor
ofsession
's connector.- Type Parameters:
T
- annotated type of user-defined handler- Parameters:
type
- Reference toT
typesession
- 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
- whentype
is 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 annotatedT
type. Use custom instance ofUnivalConvertor
.- Type Parameters:
T
- annotated type of user-defined handler- Parameters:
type
- Reference toT
typesession
- 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
- whentype
is annotated incorrectly
-
-