Beispiel #1
0
  public void prepareWalker(Walker walker, SAMFileReader.ValidationStringency strictnessLevel) {
    for (Map.Entry<ArgumentSource, Object> io : inputs.entrySet()) {
      ArgumentSource targetField = io.getKey();
      Object targetValue = io.getValue();

      // Ghastly hack: reaches in and finishes building out the SAMFileReader.
      // TODO: Generalize this, and move it to its own initialization step.
      if (targetValue instanceof SAMFileReaderBuilder) {
        SAMFileReaderBuilder builder = (SAMFileReaderBuilder) targetValue;
        builder.setValidationStringency(strictnessLevel);
        targetValue = builder.build();
      }

      JVMUtils.setFieldValue(targetField.field, walker, targetValue);
    }
  }
Beispiel #2
0
 /**
  * Install an OutputStreamStub into the given fieldName of the given walker.
  *
  * @param walker Walker into which to inject the field name.
  * @param fieldName Name of the field into which to inject the stub.
  */
 private void installStub(Walker walker, String fieldName, OutputStream outputStream) {
   Field field = JVMUtils.findField(walker.getClass(), fieldName);
   JVMUtils.setFieldValue(field, walker, outputStream);
 }