plugins/transforms/switchcase/src/main/java/org/apache/hop/pipeline/transforms/switchcase/SwitchCase.java
void createOutputValueMapping() throws HopException {
    data.outputRowMeta = getInputRowMeta().clone();
    meta.getFields( getInputRowMeta(), getTransformName(), null, null, this, metadataProvider );

    data.fieldIndex = getInputRowMeta().indexOfValue( meta.getFieldname() );
    if ( data.fieldIndex < 0 ) {
      throw new HopException( BaseMessages.getString( PKG, "SwitchCase.Exception.UnableToFindFieldName", meta
        .getFieldname() ) );
    }

    data.inputValueMeta = getInputRowMeta().getValueMeta( data.fieldIndex );

    try {
      ITransformIOMeta ioMeta = meta.getTransformIOMeta();

      // There is one or many case target for each target stream.
      // The ioMeta object has one more target stream for the default target though.
      //
      List<IStream> targetStreams = ioMeta.getTargetStreams();
      for ( int i = 0; i < targetStreams.size(); i++ ) {
        SwitchCaseTarget target = (SwitchCaseTarget) targetStreams.get( i ).getSubject();
        if ( target == null ) {
          break; // Skip over default option
        }
        if ( target.caseTargetTransform == null ) {
          throw new HopException( BaseMessages.getString(
            PKG, "SwitchCase.Log.NoTargetTransformSpecifiedForValue", target.caseValue ) );
        }

        IRowSet rowSet = findOutputRowSet( target.caseTargetTransform.getName() );
        if ( rowSet == null ) {
          throw new HopException( BaseMessages.getString(
            PKG, "SwitchCase.Log.UnableToFindTargetRowSetForTransform", target.caseTargetTransform ) );
        }

        try {
          Object value =
            data.valueMeta.convertDataFromString(
              target.caseValue, data.stringValueMeta, null, null, IValueMeta.TRIM_TYPE_NONE );

          // If we have a value and a rowset, we can store the combination in the map
          //
          if ( data.valueMeta.isNull( value ) ) {
            data.nullRowSetSet.add( rowSet );
          } else {
            // could not use byte[] as key in Maps, so we need to convert it to his specific hashCode for future
            // comparisons
            value = prepareObjectType( value );
            data.outputMap.put( value, rowSet );
          }
        } catch ( Exception e ) {
          throw new HopException( BaseMessages.getString(
            PKG, "SwitchCase.Log.UnableToConvertValue", target.caseValue ), e );
        }
      }

      if ( meta.getDefaultTargetTransform() != null ) {
        IRowSet rowSet = findOutputRowSet( meta.getDefaultTargetTransform().getName() );
        if ( rowSet != null ) {
          data.defaultRowSetSet.add( rowSet );
          if ( data.nullRowSetSet.isEmpty() ) {
            data.nullRowSetSet.add( rowSet );
          }
        }
      }
    } catch ( Exception e ) {
      throw new HopException( e );
    }
  }
/**
   * This will prepare transform for execution:
   * <ol>
   * <li>will copy input row meta info, fields info, etc. transform related info
   * <li>will get transform IO meta info and discover target streams for target output transforms
   * <li>for every target output find output rowset and expected value.
   * <li>for every discovered output rowset put it as a key-value: 'expected value'-'output rowSet'. If expected value
   * is null - put output rowset to special 'null set' (avoid usage of null as a map keys)
   * <li>Discover default row set. We expect only one default rowset, even if technically can have many. *
   * </ol>
   *
   * @throws HopException if something goes wrong during transform preparation.
   */
This will prepare transform for execution:

will copy input row meta info, fields info, etc. transform related info
will get transform IO meta info and discover target streams for target output transforms
for every target output find output rowset and expected value.
for every discovered output rowset put it as a key-value: 'expected value'-'output rowSet'. If expected value
is null - put output rowset to special 'null set' (avoid usage of null as a map keys)
Discover default row set. We expect only one default rowset, even if technically can have many.

@throws HopException if something goes wrong during transform preparation.
This will prepare transform for execution : will copy input row meta info fields info etc . transform related info will get transform IO meta info and discover target streams for target output transforms for every target output find output rowset and expected value . for every discovered output rowset put it as a key - value : ' expected value ' - ' output rowSet ' . If expected value is null - put output rowset to special ' null set ' ( avoid usage of null as a map keys ) Discover default row set . We expect only one default rowset even if technically can have many . @throws HopException if something goes wrong during transform preparation .
void createOutputValueMapping() throws HopException {
    data.outputRowMeta = getInputRowMeta().clone();
    meta.getFields( getInputRowMeta(), getTransformName(), null, null, this, metadataProvider );
    data.fieldIndex = getInputRowMeta().indexOfValue( meta.getFieldname() );
    if ( data.fieldIndex < 0 ) {
      throw new HopException( BaseMessages.getString( PKG, "SwitchCase.Exception.UnableToFindFieldName", meta
        .getFieldname() ) );
    }
    data.inputValueMeta = getInputRowMeta().getValueMeta( data.fieldIndex );
    try {
      ITransformIOMeta ioMeta = meta.getTransformIOMeta();
      List<IStream> targetStreams = ioMeta.getTargetStreams();
      for ( int i = 0; i < targetStreams.size(); i++ ) {
        SwitchCaseTarget target = (SwitchCaseTarget) targetStreams.get( i ).getSubject();
        if ( target == null ) {
          break;  Skip over default option
        }
        if ( target.caseTargetTransform == null ) {
          throw new HopException( BaseMessages.getString(
            PKG, "SwitchCase.Log.NoTargetTransformSpecifiedForValue", target.caseValue ) );
        }
        IRowSet rowSet = findOutputRowSet( target.caseTargetTransform.getName() );
        if ( rowSet == null ) {
          throw new HopException( BaseMessages.getString(
            PKG, "SwitchCase.Log.UnableToFindTargetRowSetForTransform", target.caseTargetTransform ) );
        }
        try {
          Object value =
            data.valueMeta.convertDataFromString(
              target.caseValue, data.stringValueMeta, null, null, IValueMeta.TRIM_TYPE_NONE );
           If we have a value and a rowset, we can store the combination in the map
          if ( data.valueMeta.isNull( value ) ) {
            data.nullRowSetSet.add( rowSet );
          } else {
             could not use byte[] as key in Maps, so we need to convert it to his specific hashCode for future
             comparisons
            value = prepareObjectType( value );
            data.outputMap.put( value, rowSet );
          }
        } catch ( Exception e ) {
          throw new HopException( BaseMessages.getString(
            PKG, "SwitchCase.Log.UnableToConvertValue", target.caseValue ), e );
        }
      }
      if ( meta.getDefaultTargetTransform() != null ) {
        IRowSet rowSet = findOutputRowSet( meta.getDefaultTargetTransform().getName() );
        if ( rowSet != null ) {
          data.defaultRowSetSet.add( rowSet );
          if ( data.nullRowSetSet.isEmpty() ) {
            data.nullRowSetSet.add( rowSet );
          }
        }
      }
    } catch ( Exception e ) {
      throw new HopException( e );
    }
  }
void createOutputValueMapping ( ) throws HopException { data . outputRowMeta = getInputRowMeta ( ) . clone ( ) ; meta . getFields ( getInputRowMeta ( ) , getTransformName ( ) , null , null , this , metadataProvider ) ; data . fieldIndex = getInputRowMeta ( ) . indexOfValue ( meta . getFieldname ( ) ) ; if ( data . fieldIndex < 0 ) { throw new HopException ( BaseMessages . getString ( PKG , "SwitchCase.Exception.UnableToFindFieldName" , meta . getFieldname ( ) ) ) ; } data . inputValueMeta = getInputRowMeta ( ) . getValueMeta ( data . fieldIndex ) ; try { ITransformIOMeta ioMeta = meta . getTransformIOMeta ( ) ; List < IStream > targetStreams = ioMeta . getTargetStreams ( ) ; for ( int i = 0 ; i < targetStreams . size ( ) ; i ++ ) { SwitchCaseTarget target = ( SwitchCaseTarget ) targetStreams . get ( i ) . getSubject ( ) ; if ( target == null ) { break ; } if ( target . caseTargetTransform == null ) { throw new HopException ( BaseMessages . getString ( PKG , "SwitchCase.Log.NoTargetTransformSpecifiedForValue" , target . caseValue ) ) ; } IRowSet rowSet = findOutputRowSet ( target . caseTargetTransform . getName ( ) ) ; if ( rowSet == null ) { throw new HopException ( BaseMessages . getString ( PKG , "SwitchCase.Log.UnableToFindTargetRowSetForTransform" , target . caseTargetTransform ) ) ; } try { Object value = data . valueMeta . convertDataFromString ( target . caseValue , data . stringValueMeta , null , null , IValueMeta . TRIM_TYPE_NONE ) ; if ( data . valueMeta . isNull ( value ) ) { data . nullRowSetSet . add ( rowSet ) ; } else { value = prepareObjectType ( value ) ; data . outputMap . put ( value , rowSet ) ; } } catch ( Exception e ) { throw new HopException ( BaseMessages . getString ( PKG , "SwitchCase.Log.UnableToConvertValue" , target . caseValue ) , e ) ; } } if ( meta . getDefaultTargetTransform ( ) != null ) { IRowSet rowSet = findOutputRowSet ( meta . getDefaultTargetTransform ( ) . getName ( ) ) ; if ( rowSet != null ) { data . defaultRowSetSet . add ( rowSet ) ; if ( data . nullRowSetSet . isEmpty ( ) ) { data . nullRowSetSet . add ( rowSet ) ; } } } } catch ( Exception e ) { throw new HopException ( e ) ; } }
This will prepare transform for execution:
 <ol>
 <li>will copy input row meta info, fields info, etc.
This will prepare transform for execution : <ol > <li > will copy input row meta info fields info etc .
// There is one or many case target for each target stream. // The ioMeta object has one more target stream for the default target though. // // Skip over default option // If we have a value and a rowset, we can store the combination in the map // // could not use byte[] as key in Maps, so we need to convert it to his specific hashCode for future // comparisons