class SwitchCase extends BaseTransform<SwitchCaseMeta, SwitchCaseData> implements ITransform<SwitchCaseMeta, SwitchCaseData> {

  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 );
    }
  }

  public  SwitchCase( TransformMeta transformMeta, SwitchCaseMeta meta, SwitchCaseData data, int copyNr, PipelineMeta pipelineMeta,
                     Pipeline pipeline );

}