|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.crsh.shell.impl.command.pipeline.CommandInvokerAdapter<C,P,CONSUMER>
class CommandInvokerAdapter<C,P,CONSUMER extends CommandContext<? super P>>
Field Summary | |
---|---|
private ScreenContextConsumer |
adapter . |
private boolean |
charSequenceConsumer . |
private boolean |
clsConsumer . |
(package private) CommandInvoker<C,P> |
command . |
private Class<C> |
consumedType . |
protected CONSUMER |
consumer . |
private Class<P> |
producedType . |
private ScreenContext |
screenContext . |
private boolean |
styleConsumer . |
Constructor Summary | |
---|---|
CommandInvokerAdapter(CommandInvoker<C,P> command, Class<C> consumedType, Class<P> producedType) |
Method Summary | |
---|---|
Appendable |
append(char c) |
Appendable |
append(CharSequence s) |
Appendable |
append(CharSequence csq, int start, int end) |
Screenable |
append(Style style) |
void |
close() Close the producer. |
Screenable |
cls() |
void |
flush() Flush the stream. |
Map<String,Object> |
getAttributes() Returns the current attributes. |
Class<Object> |
getConsumedType() Returns the class of the element generic type. |
int |
getHeight() Returns the screen height in chars. |
Class<P> |
getProducedType() Returns the class of the produced type. |
String |
getProperty(String propertyName) Returns a generic property, usually this property is resolved by the shell client. |
Map<String,Object> |
getSession() Returns the current session. |
int |
getWidth() Returns the screen width in chars. |
void |
open(CONSUMER consumer) Open the producer with the specified consumer. |
void |
provide(Object element) Provide an element. |
String |
readLine(String msg, boolean echo) Display a message and read a line on the console, this method call can be blocking until the user provides a value. |
boolean |
releaseAlternateBuffer() Release control of the alternate buffer. |
boolean |
takeAlternateBuffer() Take control of the alternate buffer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
final CommandInvoker<C,P> command
protected CONSUMER extends CommandContext<? super P> consumer
private final Class<C> consumedType
private final Class<P> producedType
private ScreenContextConsumer adapter
private ScreenContext screenContext
private final boolean charSequenceConsumer
private final boolean styleConsumer
private final boolean clsConsumer
Constructor Detail |
---|
CommandInvokerAdapter(CommandInvoker<C,P> command, Class<C> consumedType, Class<P> producedType)
Method Detail |
---|
public boolean takeAlternateBuffer() throws IOException
InteractionContext
ScreenContext.flush()
method is invoked.
takeAlternateBuffer
in interface InteractionContext
IOException
public boolean releaseAlternateBuffer() throws IOException
InteractionContext
ScreenContext.flush()
method is invoked.
releaseAlternateBuffer
in interface InteractionContext
IOException
public String getProperty(String propertyName)
InteractionContext
getProperty
in interface InteractionContext
propertyName
- the property namepublic String readLine(String msg, boolean echo) throws IOException, InterruptedException
InteractionContext
readLine
in interface InteractionContext
msg
- the message to display before reading a lineecho
- wether or not the line read should be echoed when typingIOException
- any io exceptionInterruptedException
- the thread was interrupted while waiting for the user valuepublic Map<String,Object> getSession()
RuntimeContext
getSession
in interface RuntimeContext
public Map<String,Object> getAttributes()
RuntimeContext
getAttributes
in interface RuntimeContext
public int getWidth()
ScreenContext
getWidth
in interface ScreenContext
public int getHeight()
ScreenContext
getHeight
in interface ScreenContext
public void open(CONSUMER consumer) throws Exception
Producer
open
in interface Producer<P,CONSUMER extends CommandContext<? super P>>
consumer
- the consumerException
- any exceptionpublic Class<Object> getConsumedType()
Consumer
getConsumedType
in interface Consumer<Object>
public Class<P> getProducedType()
Producer
getProducedType
in interface Producer<P,CONSUMER extends CommandContext<? super P>>
public void provide(Object element) throws Exception
Consumer
provide
in interface Consumer<Object>
element
- the provided elementException
- any exceptionpublic Appendable append(char c) throws IOException
append
in interface Appendable
IOException
public Appendable append(CharSequence s) throws IOException
append
in interface Appendable
IOException
public Appendable append(CharSequence csq, int start, int end) throws IOException
append
in interface Appendable
IOException
public Screenable append(Style style) throws IOException
append
in interface Screenable
IOException
public Screenable cls() throws IOException
cls
in interface Screenable
IOException
public void flush() throws IOException
Consumer
flush
in interface Consumer<Object>
flush
in interface ScreenContext
IOException
- any io exceptionpublic void close() throws Exception
Producer
close
in interface CommandContext<Object>
close
in interface Producer<P,CONSUMER extends CommandContext<? super P>>
Exception
- any exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |