Class CosIdInterceptor

java.lang.Object
me.ahoo.cosid.mybatis.CosIdInterceptor
All Implemented Interfaces:
org.apache.ibatis.plugin.Interceptor

@Intercepts(@Signature(type=org.apache.ibatis.executor.Executor.class,method="update",args={org.apache.ibatis.mapping.MappedStatement.class,java.lang.Object.class})) public class CosIdInterceptor extends Object implements org.apache.ibatis.plugin.Interceptor
Fills the CosId ids of an INSERT's parameter before it runs: the entity itself, or each entity of the collection under listKey of a multi-parameter map (a batch insert, insertAll(@Param("list") List<Order> orders)).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The parameter name of a batch insert's entities by default, MyBatis' own for a single collection parameter.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CosIdInterceptor(me.ahoo.cosid.accessor.IdFiller filler)
    An interceptor of the default list key.
    CosIdInterceptor(me.ahoo.cosid.accessor.IdFiller filler, String listKey)
    An interceptor.
  • Method Summary

    Modifier and Type
    Method
    Description
    intercept(org.apache.ibatis.plugin.Invocation invocation)
     
    The parameter name of a batch insert's entities.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.ibatis.plugin.Interceptor

    plugin, setProperties
  • Field Details

    • DEFAULT_LIST_KEY

      public static final String DEFAULT_LIST_KEY
      The parameter name of a batch insert's entities by default, MyBatis' own for a single collection parameter.
      See Also:
  • Constructor Details

    • CosIdInterceptor

      public CosIdInterceptor(me.ahoo.cosid.accessor.IdFiller filler)
      An interceptor of the default list key.
      Parameters:
      filler - the filler
    • CosIdInterceptor

      public CosIdInterceptor(me.ahoo.cosid.accessor.IdFiller filler, String listKey)
      An interceptor.
      Parameters:
      filler - the filler
      listKey - the parameter name of a batch insert's entities
  • Method Details

    • listKey

      public String listKey()
      The parameter name of a batch insert's entities.
      Returns:
      the key
    • intercept

      public Object intercept(org.apache.ibatis.plugin.Invocation invocation) throws Throwable
      Specified by:
      intercept in interface org.apache.ibatis.plugin.Interceptor
      Throws:
      Throwable