Class PrePostConditionInterceptor

java.lang.Object
jadex.providedservice.impl.service.interceptors.AbstractApplicableInterceptor
jadex.providedservice.impl.service.interceptors.ComponentThreadInterceptor
jadex.providedservice.impl.service.interceptors.AbstractLRUApplicableInterceptor
jadex.providedservice.impl.interceptors.PrePostConditionInterceptor
All Implemented Interfaces:
jadex.providedservice.impl.service.IServiceInvocationInterceptor

public class PrePostConditionInterceptor extends jadex.providedservice.impl.service.interceptors.AbstractLRUApplicableInterceptor
Interceptor that checks annotated pre- and postconditions.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected class 
    Check return value, when service call is finished.
    static class 
     
    static class 
    Fetcher for pre and post condition.
  • Field Summary

    Fields inherited from class jadex.providedservice.impl.service.interceptors.AbstractLRUApplicableInterceptor

    applicables

    Fields inherited from class jadex.providedservice.impl.service.interceptors.ComponentThreadInterceptor

    ia
  • Constructor Summary

    Constructors
    Constructor
    Description
    PrePostConditionInterceptor(jadex.core.impl.Component ia)
    Create a new AbstractLRUApplicableInterceptor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Exception
    checkPostConditions(jadex.providedservice.impl.service.ServiceInvocationContext context, Object res, boolean intermediate, List<Object> ires)
    Check the postconditions.
    checkPreConditions(jadex.providedservice.impl.service.ServiceInvocationContext context)
    Check the precondition.
    boolean
    customIsApplicable(jadex.providedservice.impl.service.ServiceInvocationContext context)
    Test if the interceptor is applicable.
    jadex.future.IFuture<Void>
    execute(jadex.providedservice.impl.service.ServiceInvocationContext context)
    Execute the interceptor.
    protected int
    getKeepForPostConditions(jadex.providedservice.impl.service.ServiceInvocationContext context)
    Get the number of intermediate results that should be explicitly kept by the interceptor (only necessary for subscription futures).
    protected boolean
    Check if an annotation belongs to the supported types of pre/postconditions.

    Methods inherited from class jadex.providedservice.impl.service.interceptors.AbstractLRUApplicableInterceptor

    isApplicable

    Methods inherited from class jadex.providedservice.impl.service.interceptors.ComponentThreadInterceptor

    getComponent

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PrePostConditionInterceptor

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

    • customIsApplicable

      public boolean customIsApplicable(jadex.providedservice.impl.service.ServiceInvocationContext context)
      Test if the interceptor is applicable.
      Specified by:
      customIsApplicable in class jadex.providedservice.impl.service.interceptors.AbstractLRUApplicableInterceptor
      Returns:
      True, if applicable.
    • isPrePostCondition

      protected boolean isPrePostCondition(Annotation anno)
      Check if an annotation belongs to the supported types of pre/postconditions.
    • execute

      public jadex.future.IFuture<Void> execute(jadex.providedservice.impl.service.ServiceInvocationContext context)
      Execute the interceptor.
      Parameters:
      context - The invocation context.
    • checkPreConditions

      protected RuntimeException checkPreConditions(jadex.providedservice.impl.service.ServiceInvocationContext context)
      Check the precondition.
    • checkPostConditions

      protected Exception checkPostConditions(jadex.providedservice.impl.service.ServiceInvocationContext context, Object res, boolean intermediate, List<Object> ires)
      Check the postconditions.
    • getKeepForPostConditions

      protected int getKeepForPostConditions(jadex.providedservice.impl.service.ServiceInvocationContext context)
      Get the number of intermediate results that should be explicitly kept by the interceptor (only necessary for subscription futures).