Class ResolveInterceptor

java.lang.Object
jadex.providedservice.impl.service.interceptors.AbstractApplicableInterceptor
jadex.providedservice.impl.service.interceptors.ResolveInterceptor
All Implemented Interfaces:
IServiceInvocationInterceptor

public class ResolveInterceptor extends AbstractApplicableInterceptor
The resolve interceptor is responsible for determining the object on which the method invocation is finally performed. Checks whether the object is a ServiceInfo. In this case it delegates method calls of I(Internal)Service to the automatically created BasicService instance and all other calls to the domain object. // todo: much annotation stuff and injection of objects to the pojo.
  • Field Details

    • SERVICEMETHODS

      public static final Set<Method> SERVICEMETHODS
      The static map of subinterceptors (method -> interceptor).
    • START_METHOD

      protected static final Method START_METHOD
    • SHUTDOWN_METHOD

      protected static final Method SHUTDOWN_METHOD
    • INVOKE_METHOD

      protected static final Method INVOKE_METHOD
    • ia

      protected jadex.core.impl.Component ia
      The component.
  • Constructor Details

    • ResolveInterceptor

      public ResolveInterceptor(jadex.core.impl.Component ia)
      Create a new ResolveInterceptor.
  • Method Details

    • execute

      public jadex.future.IFuture<Void> execute(ServiceInvocationContext sic)
      Execute the interceptor.
      Parameters:
      sic - The invocation context.
      context - The invocation context.
    • searchMethod

      public static Method searchMethod(Class<?> impl, Class<? extends Annotation> annotation)
      Search an annotation method.
    • invokeDoubleMethod

      protected jadex.future.IFuture<Void> invokeDoubleMethod(ServiceInvocationContext sic, ServiceInfo si, Method m, Class<? extends Annotation> annotation, boolean firstorig, boolean ignorenotfound)
      Invoke double methods. The boolean 'firstorig' determines if basicservice method is called first.
    • findMethod

      protected jadex.common.Tuple2<Method,Object[]> findMethod(Object[] params, jadex.common.ClassInfo[] argtypes, Class<?> serclazz, String methodname)
      Find the correct method by its name and parameter values. The parameter values are half-evaluated, i.e. if they are deserialized as far as possible. Still serialized parameters are saved as SerialiedObject. Those are deserialized using the parameter class as hint.
      Parameters:
      serclazz - The target class.
      methodname - The method name
      decparams - Partially decoded parameters.
      Returns:
      The method and further decoded parameters.
    • generateParameters

      protected Object[] generateParameters(Object[] vals, Method m) throws Exception
      Generate call parameters.
      Parameters:
      vals - The current parameters.
      Returns:
      The adapted method call parameters.
      Throws:
      Exception
    • convertParameter

      protected Object convertParameter(Object value, Type targettype) throws Exception
      Convert a parameter to a target type.
      Throws:
      Exception
    • getSerializationServices

      public final jadex.serialization.ISerializationServices getSerializationServices()
    • convertToJsonString

      protected String convertToJsonString(Object val)
      Convert an object to the json string representation.
      Parameters:
      val - The value.
      Returns:
      The string representation.
    • convertFromJsonString

      protected Object convertFromJsonString(String val, Class<?> type)
      Convert json to object representation.
      Parameters:
      val - The json value.
      Returns:
      The object.
    • convertFromString

      protected Object convertFromString(String val, Class<?> type)
      Convert to object representation.
      Parameters:
      val - The string value.
      Returns:
      The object.
    • isSupportedBasicType

      protected boolean isSupportedBasicType(Class<?> type)
      Test if basic converter can handle this type.
      Parameters:
      type - The type.
      Returns:
      True if it can handle this type.