/** * Returns a padded to length String text representation of this Value * * @return a padded to length String text representation of this Value */ @Override public String toString() { return toString( true ); }
/** * Convert the row to a String representation. * * @return the row as a String. */ @Override public String toString() { StringBuilder retval = new StringBuilder( 128 ); retval.append( '[' ); for ( int i = 0; i < size(); i++ ) { Value value = getValue( i ); if ( i != 0 ) { retval.append( ", " ); } if ( value != null ) { retval.append( value.getName() ).append( '=' ).append( value.toString( false ) ); } else { retval.append( "NULL" ); } } retval.append( ']' ); return retval.toString(); }
public static String jsToString( Object value, String classType ) { if ( classType.equalsIgnoreCase( "org.mozilla.javascript.NativeJavaObject" ) || classType.equalsIgnoreCase( "org.mozilla.javascript.Undefined" ) ) { // Is it a java Value class ? try { Value v = (Value) Context.jsToJava( value, Value.class ); return v.toString(); } catch ( Exception ev ) { // convert to a string should work in most cases... // return Context.toString( value ); } } else { // A String perhaps? return Context.toString( value ); } }
/** * Print the names and the String representations of the values of the Values in row to stdout. */ public void print() { int i; for ( i = 0; i < size(); i++ ) { System.out.println( "Element[" + i + "] = [" + getValue( i ).getName() + "] = " + getValue( i ).toString() ); } }
/** * Produce the XML representation of this value. * * @return a String containing the XML to represent this Value. */ @Override public String getXML() { StringBuilder retval = new StringBuilder( 128 ); retval.append( "<" + XML_TAG + ">" ); retval.append( XMLHandler.addTagValue( "name", getName(), false ) ); retval.append( XMLHandler.addTagValue( "type", getTypeDesc(), false ) ); retval.append( XMLHandler.addTagValue( "text", toString( false ), false ) ); retval.append( XMLHandler.addTagValue( "length", getLength(), false ) ); retval.append( XMLHandler.addTagValue( "precision", getPrecision(), false ) ); retval.append( XMLHandler.addTagValue( "isnull", isNull(), false ) ); retval.append( "</" + XML_TAG + ">" ); return retval.toString(); }
public Value rtrim() { if ( isNull() ) { setType( VALUE_TYPE_STRING ); } else { String s; if ( getType() == VALUE_TYPE_STRING ) { s = Const.rtrim( getString() ); } else { s = Const.rtrim( toString() ); } setValue( s ); } return this; }
public Value ltrim() { if ( isNull() ) { setType( VALUE_TYPE_STRING ); } else { if ( getString() != null ) { String s; if ( getType() == VALUE_TYPE_STRING ) { s = Const.ltrim( getString() ); } else { s = Const.ltrim( toString() ); } setValue( s ); } else { setNull(); } } return this; }