Package ome.services.blitz.util
Class IceMethodInvoker
- java.lang.Object
-
- ome.services.blitz.util.IceMethodInvoker
-
public class IceMethodInvoker extends java.lang.Object
Method
-cache primed either with anServiceInterface
instance or with aClass
with generic typeServiceInterface
. Actual invocation happens viainvoke(Object, Ice.Current, IceMapper, Object[])
No reference is held to the initial priming argument inIceMethodInvoker(ServiceInterface, OmeroContext)
just the class. MAPPING RULES:- Method names exact
- Collections of the same type only (no arrays)
- Primitives use Ice primitives (long, int, bool,...)
- Primitive wrappers all use RTypes (RLong, RInt, RBool,...)
- Currently ignoring
NotNull
annotations
- Since:
- 3.0-Beta2
-
-
Constructor Summary
Constructors Constructor Description IceMethodInvoker(java.lang.Class<S> k, ome.system.OmeroContext context)
Creates anIceMethodInvoker
instance by using reflection on theClass
argument.IceMethodInvoker(ome.api.ServiceInterface srv, ome.system.OmeroContext context)
Create anIceMethodInvoker
instance using theClass
of the passed argument to callIceMethodInvoker(Class, OmeroContext)
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.reflect.Method
getMethod(java.lang.String name)
For testing the cached method.java.lang.Object
invoke(java.lang.Object obj, Ice.Current current, IceMapper mapper, java.lang.Object... args)
Calls the method named inCurrent.operation
with the arguments provided mapped via theIceMapper
instance.boolean
isVoid(Ice.Current current)
Checks for a void return type, which is needed to know what type of ice_response() method to invoke.
-
-
-
Constructor Detail
-
IceMethodInvoker
public IceMethodInvoker(ome.api.ServiceInterface srv, ome.system.OmeroContext context)
Create anIceMethodInvoker
instance using theClass
of the passed argument to callIceMethodInvoker(Class, OmeroContext)
.- Parameters:
srv
- A Non-nullServiceInterface
instance.context
- The activeOmeroContext
instance.
-
IceMethodInvoker
public IceMethodInvoker(java.lang.Class<S> k, ome.system.OmeroContext context)
Creates anIceMethodInvoker
instance by using reflection on theClass
argument. All information is cached internally in a staticmap
if the given service class argument has not already been cached.- Type Parameters:
S
- A type which subclassesServiceInterface
- Parameters:
context
- A non-nullServiceInterface
Class
-
-
Method Detail
-
isVoid
public boolean isVoid(Ice.Current current)
Checks for a void return type, which is needed to know what type of ice_response() method to invoke.
-
invoke
public java.lang.Object invoke(java.lang.Object obj, Ice.Current current, IceMapper mapper, java.lang.Object... args) throws Ice.UserException
Calls the method named inCurrent.operation
with the arguments provided mapped via theIceMapper
instance. The return value or any method which is thrown is equally mapped and returned. Exceptions are handled byIceMapper.handleException(Throwable, OmeroContext)
.- Parameters:
obj
- Instance for the call toMethod.invoke(Object, Object[])
. Can be null if this is a static call.current
- The current Ice operation. Non-null.mapper
- A non-null mapper.args
- The proper number of arguments for the method specified in current.- Returns:
- Either the return value of the invocation, or the exception if one was thrown.
- Throws:
Ice.UserException
-
getMethod
public java.lang.reflect.Method getMethod(java.lang.String name)
For testing the cached method.
-
-