org.crsh.lang.impl.groovy.closure
Class ClosureInvoker

java.lang.Object
  extended by org.crsh.shell.impl.command.spi.CommandInvoker<Object,Object>
      extended by org.crsh.lang.impl.groovy.closure.ClosureInvoker
All Implemented Interfaces:
Consumer<Object>, Filter<Object,Object,CommandContext<? super Object>>, Producer<Object,CommandContext<? super Object>>

public class ClosureInvoker
extends CommandInvoker<Object,Object>

Author:
Julien Viet

Field Summary
private  groovy.lang.Closure closure
          .
private  CommandContext<? super Object> consumer
          .
private  Class<?> type
          .
 
Constructor Summary
ClosureInvoker(groovy.lang.Closure closure)
           
 
Method Summary
 void close()
          Close the producer.
 void flush()
          Flush the stream.
 Class<Object> getConsumedType()
          Returns the class of the element generic type.
 Class<Object> getProducedType()
          Returns the class of the produced type.
 void open(CommandContext<? super Object> consumer)
          Open the producer with the specified consumer.
 void provide(Object element)
          Provide an element.
 
Methods inherited from class org.crsh.shell.impl.command.spi.CommandInvoker
getKeyHandler, getScreenContext, invoke
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

closure

private final groovy.lang.Closure closure
.


type

private final Class<?> type
.


consumer

private CommandContext<? super Object> consumer
.

Constructor Detail

ClosureInvoker

public ClosureInvoker(groovy.lang.Closure closure)
Method Detail

getProducedType

public Class<Object> getProducedType()
Description copied from interface: Producer
Returns the class of the produced type.

Returns:
the produced type

getConsumedType

public Class<Object> getConsumedType()
Description copied from interface: Consumer
Returns the class of the element generic type.

Returns:
the consumed type

provide

public void provide(Object element)
             throws IOException,
                    CommandException
Description copied from interface: Consumer
Provide an element.

Specified by:
provide in interface Consumer<Object>
Specified by:
provide in class CommandInvoker<Object,Object>
Parameters:
element - the provided element
Throws:
IOException
CommandException

open

public void open(CommandContext<? super Object> consumer)
Description copied from interface: Producer
Open the producer with the specified consumer.

Specified by:
open in interface Producer<Object,CommandContext<? super Object>>
Specified by:
open in class CommandInvoker<Object,Object>
Parameters:
consumer - the consumer

flush

public void flush()
           throws IOException
Description copied from interface: Consumer
Flush the stream.

Specified by:
flush in interface Consumer<Object>
Specified by:
flush in class CommandInvoker<Object,Object>
Throws:
IOException - any io exception

close

public void close()
Description copied from interface: Producer
Close the producer.

Specified by:
close in interface Producer<Object,CommandContext<? super Object>>
Specified by:
close in class CommandInvoker<Object,Object>


Copyright © 2015 eXo Platform SAS. All Rights Reserved.