Package cn.sliew.milky.common.chain
Class DefaultPipeline<K,V>
- java.lang.Object
-
- cn.sliew.milky.common.chain.DefaultPipeline<K,V>
-
-
Constructor Summary
Constructors Constructor Description DefaultPipeline()todo final chain target,maybe not exists,need one invoker
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PipelineaddAfter(String baseName, String name, Command command)Inserts aCommandafter an existing command of this pipeline.PipelineaddBefore(String baseName, String name, Command command)Inserts aCommandbefore an existing command of this pipeline.PipelineaddFirst(String name, Command command)Inserts aPipelineProcessat the first position of this pipeline.PipelineaddLast(String name, Command command)Appends aPipelineProcessat the last position of this pipeline.PipelineProcesscontext(Command command)Returns the context object of the specifiedCommandin this pipeline.PipelineProcesscontext(Class commandType)Returns the context object of theCommandof the specified type in this pipeline.PipelineProcesscontext(String name)Returns the context object of theCommandwith the specified name in this pipeline.PipelinefireEvent(Context<K,V> context, CompletableFuture<?> future)PipelinefireExceptionCaught(Context<K,V> context, Throwable cause, CompletableFuture<?> future)Commandfirst()Returns the firstCommandin this pipeline.PipelineProcessfirstContext()Returns the context of the firstCommandin this pipeline.Commandget(Class commandType)Returns theCommandof the specified type in this pipeline.Commandget(String name)Returns theCommandwith the specified name in this pipeline.Commandlast()Returns the lastCommandin this pipeline.PipelineProcesslastContext()Returns the context of the lastCommandin this pipeline.List<String>names()Returns theListof the command names.Pipelineremove(Command command)Removes the specifiedCommandfrom this pipeline.Commandremove(Class commandType)Removes theCommandof the specified type from this pipeline.Commandremove(String name)Removes theCommandwith the specified name from this pipeline.CommandremoveFirst()Removes the firstCommandin this pipeline.CommandremoveLast()Removes the lastCommandin this pipeline.Map<String,Command<K,V>>toMap()Converts this pipeline into an orderedMapwhose keys are command names and whose values are commands.StringtoString()Returns theStringrepresentation of this pipeline.
-
-
-
Method Detail
-
addFirst
public Pipeline addFirst(String name, Command command)
Description copied from interface:PipelineInserts aPipelineProcessat the first position of this pipeline.
-
addLast
public Pipeline addLast(String name, Command command)
Description copied from interface:PipelineAppends aPipelineProcessat the last position of this pipeline.
-
addBefore
public Pipeline addBefore(String baseName, String name, Command command)
Description copied from interface:PipelineInserts aCommandbefore an existing command of this pipeline.
-
addAfter
public Pipeline addAfter(String baseName, String name, Command command)
Description copied from interface:PipelineInserts aCommandafter an existing command of this pipeline.
-
remove
public Pipeline remove(Command command)
Description copied from interface:PipelineRemoves the specifiedCommandfrom this pipeline.- Specified by:
removein interfacePipeline<K,V>- Parameters:
command- thePipelineProcessto remove
-
remove
public Command remove(String name)
Description copied from interface:PipelineRemoves theCommandwith the specified name from this pipeline.
-
remove
public final Command remove(Class commandType)
Description copied from interface:PipelineRemoves theCommandof the specified type from this pipeline.
-
removeFirst
public Command removeFirst()
Description copied from interface:PipelineRemoves the firstCommandin this pipeline.- Specified by:
removeFirstin interfacePipeline<K,V>- Returns:
- the removed command
-
removeLast
public Command removeLast()
Description copied from interface:PipelineRemoves the lastCommandin this pipeline.- Specified by:
removeLastin interfacePipeline<K,V>- Returns:
- the removed command
-
first
public Command first()
Description copied from interface:PipelineReturns the firstCommandin this pipeline.
-
last
public Command last()
Description copied from interface:PipelineReturns the lastCommandin this pipeline.
-
get
public Command get(String name)
Description copied from interface:PipelineReturns theCommandwith the specified name in this pipeline.
-
get
public Command get(Class commandType)
Description copied from interface:PipelineReturns theCommandof the specified type in this pipeline.
-
firstContext
public PipelineProcess firstContext()
Description copied from interface:PipelineReturns the context of the firstCommandin this pipeline.- Specified by:
firstContextin interfacePipeline<K,V>- Returns:
- the context of the first command.
nullif this pipeline is empty.
-
lastContext
public PipelineProcess lastContext()
Description copied from interface:PipelineReturns the context of the lastCommandin this pipeline.- Specified by:
lastContextin interfacePipeline<K,V>- Returns:
- the context of the last command.
nullif this pipeline is empty.
-
context
public PipelineProcess context(Command command)
Description copied from interface:PipelineReturns the context object of the specifiedCommandin this pipeline.
-
context
public PipelineProcess context(String name)
Description copied from interface:PipelineReturns the context object of theCommandwith the specified name in this pipeline.
-
context
public PipelineProcess context(Class commandType)
Description copied from interface:PipelineReturns the context object of theCommandof the specified type in this pipeline.
-
names
public List<String> names()
Description copied from interface:PipelineReturns theListof the command names.
-
toMap
public Map<String,Command<K,V>> toMap()
Description copied from interface:PipelineConverts this pipeline into an orderedMapwhose keys are command names and whose values are commands.
-
fireEvent
public Pipeline fireEvent(Context<K,V> context, CompletableFuture<?> future)
-
fireExceptionCaught
public Pipeline fireExceptionCaught(Context<K,V> context, Throwable cause, CompletableFuture<?> future)
- Specified by:
fireExceptionCaughtin interfacePipeline<K,V>
-
-