net.sf.staccatocommons.lang.block
Class Block2<T1,T2>

java.lang.Object
  extended by net.sf.staccatocommons.lang.function.AbstractDelayable2<T1,T2,Void>
      extended by net.sf.staccatocommons.lang.block.Block2<T1,T2>
Type Parameters:
T1 -
T2 -
All Implemented Interfaces:
net.sf.staccatocommons.defs.Applicable<T1,Block<T2>>, net.sf.staccatocommons.defs.Applicable2<T1,T2,Void>, net.sf.staccatocommons.defs.Delayable2<T1,T2,Void>, net.sf.staccatocommons.defs.Executable2<T1,T2>, net.sf.staccatocommons.defs.partial.NullSafeAware<Block2<T1,T2>>

public abstract class Block2<T1,T2>
extends AbstractDelayable2<T1,T2,Void>
implements net.sf.staccatocommons.defs.Executable2<T1,T2>, net.sf.staccatocommons.defs.Applicable<T1,Block<T2>>, net.sf.staccatocommons.defs.partial.NullSafeAware<Block2<T1,T2>>

Author:
flbulgarelli

Constructor Summary
Block2()
           
 
Method Summary
 Block<T2> apply(T1 arg0)
           
 Void apply(T1 arg0, T2 arg1)
           
 void exec(T1 arg0, T2 arg1)
          Executes this block.
 Block2<T1,T2> nullSafe()
           
protected  void softExec(T1 arg0, T2 arg1)
          Executes this block, potentially throwing a checked Exception
 Block2<T1,T2> then(net.sf.staccatocommons.defs.Executable2<T1,T2> other)
          Chains this block with the given executable, creating a new Block2 that executes this one and then the another one.
 String toString()
           
 
Methods inherited from class net.sf.staccatocommons.lang.function.AbstractDelayable2
delayed, delayedValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Block2

public Block2()
Method Detail

exec

public void exec(T1 arg0,
                 T2 arg1)
Executes this block. This implementation just invokes softExec(Object, Object), and softens any exception it may throw. Subclasses may override this behavior.

Specified by:
exec in interface net.sf.staccatocommons.defs.Executable2<T1,T2>

softExec

protected void softExec(T1 arg0,
                        T2 arg1)
                 throws Exception
Executes this block, potentially throwing a checked Exception

Parameters:
arg0 -
arg1 -
Throws:
Exception
See Also:
exec(Object, Object)

apply

@NonNull
public Block<T2> apply(T1 arg0)
Specified by:
apply in interface net.sf.staccatocommons.defs.Applicable<T1,Block<T2>>

apply

public Void apply(T1 arg0,
                  T2 arg1)
Specified by:
apply in interface net.sf.staccatocommons.defs.Applicable2<T1,T2,Void>

nullSafe

public Block2<T1,T2> nullSafe()
Specified by:
nullSafe in interface net.sf.staccatocommons.defs.partial.NullSafeAware<Block2<T1,T2>>

then

@NonNull
public final Block2<T1,T2> then(@NonNull
                                        net.sf.staccatocommons.defs.Executable2<T1,T2> other)
Chains this block with the given executable, creating a new Block2 that executes this one and then the another one.

Parameters:
other - the block to execute after this
Returns:
a new block that first invokes execute on this, and then on the Executable2 provided

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2010-2012 Staccatocommons. All Rights Reserved.