@Override public Object createTypeDefault(ParsingEngine parsingEngine,ArgumentSource source, Type type) { if(source.isRequired() || !source.defaultsToStdout()) throw new ReviewedGATKException("BUG: tried to create type default for argument type descriptor that can't support a type default."); OutputStreamStub stub = new OutputStreamStub(defaultOutputStream); engine.addOutput(stub); return createInstanceOfClass((Class)type,stub); }
@Override public Object parse( ParsingEngine parsingEngine, ArgumentSource source, Type type, ArgumentMatches matches ) { ArgumentDefinition definition = createDefaultArgumentDefinition(source); String fileName = getArgumentValue( definition, matches ).asString(); // This parser has been passed a null filename and the GATK is not responsible for creating a type default for the object; // therefore, the user must have failed to specify a type default if(fileName == null && source.isRequired()) throw new MissingArgumentValueException(definition); OutputStreamStub stub = new OutputStreamStub(new File(fileName)); engine.addOutput(stub); Object result = createInstanceOfClass(makeRawTypeIfNecessary(type),stub); // WARNING: Side effects required by engine! parsingEngine.addTags(result,getArgumentTags(matches)); return result; }