@Test public void testEmptyValues() throws Exception { RowMeta rowsMetaEmpty = new RowMeta(); rowsMetaEmpty.addValueMeta( new ValueMetaString( "str" ) ); rowsMetaEmpty.addValueMeta( new ValueMetaBoolean( "bool" ) ); rowsMetaEmpty.addValueMeta( new ValueMetaInteger( "int" ) ); rowsMetaEmpty.addValueMeta( new ValueMetaNumber( "num" ) ); rowsMetaEmpty.addValueMeta( new ValueMetaBigNumber( "bignum" ) ); rowsMetaEmpty.addValueMeta( new ValueMetaBinary( "bin" ) ); rowsMetaEmpty.addValueMeta( new ValueMetaDate( "date" ) ); rowsMetaEmpty.addValueMeta( new ValueMetaTimestamp( "timestamp" ) ); rowsMetaEmpty.addValueMeta( new ValueMetaInternetAddress( "inet" ) ); row = new RowMetaAndData( rowsMetaEmpty, null, null, null, null, null, null, null, null, null ); assertTrue( row.isEmptyValue( "str" ) ); assertTrue( row.isEmptyValue( "bool" ) ); assertTrue( row.isEmptyValue( "int" ) ); assertTrue( row.isEmptyValue( "num" ) ); assertTrue( row.isEmptyValue( "bignum" ) ); assertTrue( row.isEmptyValue( "bin" ) ); assertTrue( row.isEmptyValue( "date" ) ); assertTrue( row.isEmptyValue( "timestamp" ) ); assertTrue( row.isEmptyValue( "inet" ) ); }
public boolean isEmptyValue( String valueName ) throws KettleValueException { int idx = rowMeta.indexOfValue( valueName ); if ( idx < 0 ) { throw new KettleValueException( "Unknown column '" + valueName + "'" ); } ValueMetaInterface metaType = rowMeta.getValueMeta( idx ); switch ( metaType.getType() ) { case ValueMetaInterface.TYPE_STRING: return rowMeta.getString( data, idx ) == null; case ValueMetaInterface.TYPE_BOOLEAN: return rowMeta.getBoolean( data, idx ) == null; case ValueMetaInterface.TYPE_INTEGER: return rowMeta.getInteger( data, idx ) == null; case ValueMetaInterface.TYPE_NUMBER: return rowMeta.getNumber( data, idx ) == null; case ValueMetaInterface.TYPE_BIGNUMBER: return rowMeta.getBigNumber( data, idx ) == null; case ValueMetaInterface.TYPE_BINARY: return rowMeta.getBinary( data, idx ) == null; case ValueMetaInterface.TYPE_DATE: case ValueMetaInterface.TYPE_TIMESTAMP: return rowMeta.getDate( data, idx ) == null; case ValueMetaInterface.TYPE_INET: return rowMeta.getString( data, idx ) == null; } throw new KettleValueException( "Unknown source type: " + metaType.getTypeDesc() ); }
RowMetaAndData implements Cloneable { public boolean isEmptyValue( String valueName ) throws KettleValueException { int idx = rowMeta.indexOfValue( valueName ); if ( idx < 0 ) { throw new KettleValueException( "Unknown column '" + valueName + "'" ); } ValueMetaInterface metaType = rowMeta.getValueMeta( idx ); switch ( metaType.getType() ) { case ValueMetaInterface.TYPE_STRING: return rowMeta.getString( data, idx ) == null; case ValueMetaInterface.TYPE_BOOLEAN: return rowMeta.getBoolean( data, idx ) == null; case ValueMetaInterface.TYPE_INTEGER: return rowMeta.getInteger( data, idx ) == null; case ValueMetaInterface.TYPE_NUMBER: return rowMeta.getNumber( data, idx ) == null; case ValueMetaInterface.TYPE_BIGNUMBER: return rowMeta.getBigNumber( data, idx ) == null; case ValueMetaInterface.TYPE_BINARY: return rowMeta.getBinary( data, idx ) == null; case ValueMetaInterface.TYPE_DATE: case ValueMetaInterface.TYPE_TIMESTAMP: return rowMeta.getDate( data, idx ) == null; case ValueMetaInterface.TYPE_INET: return rowMeta.getString( data, idx ) == null; } throw new KettleValueException( "Unknown source type: " + metaType.getTypeDesc() ); } }
RowMetaAndData implements Cloneable { public boolean isEmptyValue( String valueName ) throws KettleValueException { int idx = rowMeta.indexOfValue( valueName ); if ( idx < 0 ) { throw new KettleValueException( "Unknown column '" + valueName + "'" ); } ValueMetaInterface metaType = rowMeta.getValueMeta( idx ); switch ( metaType.getType() ) { case ValueMetaInterface.TYPE_STRING: return rowMeta.getString( data, idx ) == null; case ValueMetaInterface.TYPE_BOOLEAN: return rowMeta.getBoolean( data, idx ) == null; case ValueMetaInterface.TYPE_INTEGER: return rowMeta.getInteger( data, idx ) == null; case ValueMetaInterface.TYPE_NUMBER: return rowMeta.getNumber( data, idx ) == null; case ValueMetaInterface.TYPE_BIGNUMBER: return rowMeta.getBigNumber( data, idx ) == null; case ValueMetaInterface.TYPE_BINARY: return rowMeta.getBinary( data, idx ) == null; case ValueMetaInterface.TYPE_DATE: case ValueMetaInterface.TYPE_TIMESTAMP: return rowMeta.getDate( data, idx ) == null; case ValueMetaInterface.TYPE_INET: return rowMeta.getString( data, idx ) == null; } throw new KettleValueException( "Unknown source type: " + metaType.getTypeDesc() ); } RowMetaAndData();  RowMetaAndData( RowMetaInterface rowMeta, Object... data ); }
RowMetaAndData implements Cloneable { public boolean isEmptyValue( String valueName ) throws KettleValueException { int idx = rowMeta.indexOfValue( valueName ); if ( idx < 0 ) { throw new KettleValueException( "Unknown column '" + valueName + "'" ); } ValueMetaInterface metaType = rowMeta.getValueMeta( idx ); switch ( metaType.getType() ) { case ValueMetaInterface.TYPE_STRING: return rowMeta.getString( data, idx ) == null; case ValueMetaInterface.TYPE_BOOLEAN: return rowMeta.getBoolean( data, idx ) == null; case ValueMetaInterface.TYPE_INTEGER: return rowMeta.getInteger( data, idx ) == null; case ValueMetaInterface.TYPE_NUMBER: return rowMeta.getNumber( data, idx ) == null; case ValueMetaInterface.TYPE_BIGNUMBER: return rowMeta.getBigNumber( data, idx ) == null; case ValueMetaInterface.TYPE_BINARY: return rowMeta.getBinary( data, idx ) == null; case ValueMetaInterface.TYPE_DATE: case ValueMetaInterface.TYPE_TIMESTAMP: return rowMeta.getDate( data, idx ) == null; case ValueMetaInterface.TYPE_INET: return rowMeta.getString( data, idx ) == null; } throw new KettleValueException( "Unknown source type: " + metaType.getTypeDesc() ); } RowMetaAndData();  RowMetaAndData( RowMetaInterface rowMeta, Object... data ); @Override RowMetaAndData clone(); @Override String toString(); Object[] getData(); void setData( Object[] data ); RowMetaInterface getRowMeta(); void setRowMeta( RowMetaInterface rowMeta ); @Override int hashCode(); @Override boolean equals( Object obj ); void addValue( ValueMetaInterface valueMeta, Object valueData ); void addValue( String valueName, int valueType, Object valueData ); void clear(); long getInteger( String valueName, long def ); long getInteger( int index, long def ); Long getInteger( String valueName ); Long getInteger( int index ); double getNumber( String valueName, double def ); double getNumber( int index, double def ); Date getDate( String valueName, Date def ); Date getDate( int index, Date def ); BigDecimal getBigNumber( String valueName, BigDecimal def ); BigDecimal getBigNumber( int index, BigDecimal def ); boolean getBoolean( String valueName, boolean def ); boolean getBoolean( int index, boolean def ); String getString( String valueName, String def ); String getString( int index, String def ); byte[] getBinary( String valueName, byte[] def ); byte[] getBinary( int index, byte[] def ); int compare( RowMetaAndData compare, int[] is, boolean[] bs ); boolean isNumeric( int index ); int size(); ValueMetaInterface getValueMeta( int index ); boolean isEmptyValue( String valueName ); static Object getStringAsJavaType( String vs, Class<?> destinationType, InjectionTypeConverter converter ); Object getAsJavaType( String valueName, Class<?> destinationType, InjectionTypeConverter converter ); void removeValue( String valueName ); void removeValue( int index ); void mergeRowMetaAndData( RowMetaAndData rowMetaAndData, String originStepName ); }
RowMetaAndData implements Cloneable { public boolean isEmptyValue( String valueName ) throws KettleValueException { int idx = rowMeta.indexOfValue( valueName ); if ( idx < 0 ) { throw new KettleValueException( "Unknown column '" + valueName + "'" ); } ValueMetaInterface metaType = rowMeta.getValueMeta( idx ); switch ( metaType.getType() ) { case ValueMetaInterface.TYPE_STRING: return rowMeta.getString( data, idx ) == null; case ValueMetaInterface.TYPE_BOOLEAN: return rowMeta.getBoolean( data, idx ) == null; case ValueMetaInterface.TYPE_INTEGER: return rowMeta.getInteger( data, idx ) == null; case ValueMetaInterface.TYPE_NUMBER: return rowMeta.getNumber( data, idx ) == null; case ValueMetaInterface.TYPE_BIGNUMBER: return rowMeta.getBigNumber( data, idx ) == null; case ValueMetaInterface.TYPE_BINARY: return rowMeta.getBinary( data, idx ) == null; case ValueMetaInterface.TYPE_DATE: case ValueMetaInterface.TYPE_TIMESTAMP: return rowMeta.getDate( data, idx ) == null; case ValueMetaInterface.TYPE_INET: return rowMeta.getString( data, idx ) == null; } throw new KettleValueException( "Unknown source type: " + metaType.getTypeDesc() ); } RowMetaAndData();  RowMetaAndData( RowMetaInterface rowMeta, Object... data ); @Override RowMetaAndData clone(); @Override String toString(); Object[] getData(); void setData( Object[] data ); RowMetaInterface getRowMeta(); void setRowMeta( RowMetaInterface rowMeta ); @Override int hashCode(); @Override boolean equals( Object obj ); void addValue( ValueMetaInterface valueMeta, Object valueData ); void addValue( String valueName, int valueType, Object valueData ); void clear(); long getInteger( String valueName, long def ); long getInteger( int index, long def ); Long getInteger( String valueName ); Long getInteger( int index ); double getNumber( String valueName, double def ); double getNumber( int index, double def ); Date getDate( String valueName, Date def ); Date getDate( int index, Date def ); BigDecimal getBigNumber( String valueName, BigDecimal def ); BigDecimal getBigNumber( int index, BigDecimal def ); boolean getBoolean( String valueName, boolean def ); boolean getBoolean( int index, boolean def ); String getString( String valueName, String def ); String getString( int index, String def ); byte[] getBinary( String valueName, byte[] def ); byte[] getBinary( int index, byte[] def ); int compare( RowMetaAndData compare, int[] is, boolean[] bs ); boolean isNumeric( int index ); int size(); ValueMetaInterface getValueMeta( int index ); boolean isEmptyValue( String valueName ); static Object getStringAsJavaType( String vs, Class<?> destinationType, InjectionTypeConverter converter ); Object getAsJavaType( String valueName, Class<?> destinationType, InjectionTypeConverter converter ); void removeValue( String valueName ); void removeValue( int index ); void mergeRowMetaAndData( RowMetaAndData rowMetaAndData, String originStepName );  }