public final class SimpleConsole extends Object implements Console
System.err
and System.out
.Console.MessageType
Modifier and Type | Field and Description |
---|---|
static SimpleConsole |
INSTANCE
A ready-to-use instance of
SimpleConsole |
Constructor and Description |
---|
SimpleConsole()
Equivalent to
this(null, true, MessageType.INFO) . |
SimpleConsole(String prefix,
boolean showMessageType,
Console.MessageType errorLevel)
Constructs a
SimpleConsole . |
Modifier and Type | Method and Description |
---|---|
Console.MessageType |
getErrorLevel()
Returns the least severe message type displayed by this console.
|
String |
getPrefix()
Returns the prefix to be added to the messages displayed
by this console; may return
null . |
boolean |
isShowingMessageType()
Returns
true if the type of the message should be used
to prefix the messages displayed by this console;
false otherwise. |
void |
setErrorLevel(Console.MessageType level)
Specifies the least severe message type displayed by this console.
|
void |
setPrefix(String prefix)
Specifies the prefix to be added to the messages displayed
by this console; may be
null . |
void |
setShowingMessageType(boolean show)
Specifies whether the type of the message should be used
to prefix the messages displayed by this console.
|
void |
showMessage(String message,
Console.MessageType messageType)
Show specified message to user.
|
public static final SimpleConsole INSTANCE
SimpleConsole
public SimpleConsole()
this(null, true, MessageType.INFO)
.public SimpleConsole(String prefix, boolean showMessageType, Console.MessageType errorLevel)
SimpleConsole
.prefix
- prefix to be added to the messages displayed
by this console; may be null
showMessageType
- specifies whether the type of the message
should be used to prefix the messages displayed by this consoleerrorLevel
- specifies the least severe message type
displayed by this consolepublic void setPrefix(String prefix)
null
.public String getPrefix()
null
.public void setShowingMessageType(boolean show)
public boolean isShowingMessageType()
true
if the type of the message should be used
to prefix the messages displayed by this console;
false
otherwise.public void setErrorLevel(Console.MessageType level)
public Console.MessageType getErrorLevel()
public void showMessage(String message, Console.MessageType messageType)
Console
showMessage
in interface Console
message
- a possibly multi-line messagemessageType
- type of message: Console.MessageType.INFO
, Console.MessageType.WARNING
, Console.MessageType.ERROR
or Console.MessageType.DEBUG
.