bsh.commands.print.bsh Maven / Gradle / Ivy
The newest version!
/**
Print the string value of the argument, which may be of any type.
If beanshell is running interactively, the output will always go to the
command line, otherwise it will go to System.out.
Most often the printed value of an object will simply be the Java
toString() of the object. However if the argument is an array the contents
of the array will be (recursively) listed in a verbose way.
Note that you are always free to use System.out.println()
instead of print().
*/
bsh.help.print = "usage: print( value )";
import bsh.CollectionManager;
import bsh.StringUtil;
import bsh.Primitive;
void print( arg )
{
if ( arg == null )
arg = "null";
if ( !(arg instanceof Primitive)
&& !(arg instanceof bsh.ClassIdentifier )
&& arg.getClass().isArray() )
{
print( StringUtil.normalizeClassName(arg.getClass()) + ": {");
for(int i=0; i
© 2015 - 2024 Weber Informatics LLC | Privacy Policy