/** * Returns a {@code DXDataObject} corresponding to an existing object with the specified ID, using * the specified environment. * * @param objectId DNAnexus object id * @param env environment to use to make subsequent API requests * @return a {@code DXDataObject} handle to the specified object */ public static DXDataObject getInstanceWithEnvironment(String objectId, DXEnvironment env) { if (objectId.startsWith("record-")) { return DXRecord.getInstanceWithEnvironment(objectId, env); } else if (objectId.startsWith("file-")) { return DXFile.getInstanceWithEnvironment(objectId, env); } else if (objectId.startsWith("gtable-")) { return DXGTable.getInstanceWithEnvironment(objectId, env); } else if (objectId.startsWith("applet-")) { return DXApplet.getInstanceWithEnvironment(objectId, env); } else if (objectId.startsWith("workflow-")) { return DXWorkflow.getInstanceWithEnvironment(objectId, env); } throw new IllegalArgumentException( "The object ID " + objectId + " was of an unrecognized or unsupported class."); }