
com.cedarsoft.utils.DefaultConsolePrinter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cmd Show documentation
Show all versions of cmd Show documentation
Utils for access to the command line.
The newest version!
package com.cedarsoft.utils;
import org.jetbrains.annotations.NotNull;
import java.text.MessageFormat;
/**
*
* Date: 25.08.2006
* Time: 00:59:19
*
* @author Johannes Schneider -
* Xore Systems
*/
public class DefaultConsolePrinter implements ConsolePrinter {
@NotNull
public String createError( @NotNull String message, @NotNull Object... objects ) {
StringBuilder sb = new StringBuilder();
String toPrint = MessageFormat.format( message, objects );
for ( int i = 0; i < toPrint.length(); i++ ) {
sb.append( "#" );
}
sb.append( toPrint );
sb.append( "\n" );
for ( int i = 0; i < toPrint.length(); i++ ) {
sb.append( "#" );
}
return sb.toString();
}
@NotNull
public String createWarning( @NotNull String message, @NotNull Object... objects ) {
StringBuilder sb = new StringBuilder();
String toPrint = MessageFormat.format( message, objects );
sb.append( toPrint );
sb.append( "\n" );
for ( int i = 0; i < toPrint.length(); i++ ) {
sb.append( "#" );
}
return sb.toString();
}
@NotNull
public String createSuccess( @NotNull String message, @NotNull Object... objects ) {
StringBuilder sb = new StringBuilder();
String toPrint = MessageFormat.format( message, objects );
sb.append( "!!!" );
sb.append( toPrint );
return sb.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy