Package org.beryx.textio
Class TextIoFactory
- java.lang.Object
-
- org.beryx.textio.TextIoFactory
-
public class TextIoFactory extends java.lang.Object
ProvidesTextTerminal
andTextIO
implementations.
The concreteTextTerminal
implementation is obtained as follows:- If the system property "org.beryx.textio.TextTerminal" is defined, then it is
taken to be the fully-qualified name of a concrete
TextTerminal
class. The class is loaded and instantiated. If this process fails, then the next step is executed. - a
ServiceLoader
loads the configuredTextTerminalProvider
s and searches for the first one capable to provide aTextTerminal
instance. If none is found, then the next step is executed. - A default implementation is provided as follows:
- if
System.console()
is not null, and a JLine ConsoleReader can be created, then aJLineTextTerminal
is provided. - else, if
System.console()
is not null, then aConsoleTextTerminal
is provided. - else, if the system is not headless, then a
SwingTextTerminal
is provided. - else, a
SystemTextTerminal
is provided
- if
- If the system property "org.beryx.textio.TextTerminal" is defined, then it is
taken to be the fully-qualified name of a concrete
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
TEXT_TERMINAL_CLASS_PROPERTY
-
Constructor Summary
Constructors Constructor Description TextIoFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TextIO
getTextIO()
static TextTerminal<?>
getTextTerminal()
-
-
-
Field Detail
-
TEXT_TERMINAL_CLASS_PROPERTY
public static final java.lang.String TEXT_TERMINAL_CLASS_PROPERTY
- See Also:
- Constant Field Values
-
-
Method Detail
-
getTextTerminal
public static TextTerminal<?> getTextTerminal()
-
getTextIO
public static TextIO getTextIO()
-
-