public Object materializeObject(TaskMonitor monitor,
                                    ObjectRepository repository) {
        if ((this.currentValue == null)
                || this.requiredType.isInstance(this.currentValue)) {
            return this.currentValue;
        } else if (this.currentValue instanceof String) {
            if (repository != null) {
                Object inmemObj = repository
                        .getObjectNamed((String) this.currentValue);
                if (inmemObj == null) {
                    throw new RuntimeException("No object named "
                            + this.currentValue + " found in repository.");
                }
                return inmemObj;
            }
            throw new RuntimeException("No object repository available.");
        } else if (this.currentValue instanceof Task) {
            Task task = (Task) this.currentValue;
            Object result = task.doTask(monitor, repository);
            return result;
        } else if (this.currentValue instanceof File) {
            File inputFile = (File) this.currentValue;
            Object result = null;
            try {
                result = SerializeUtils.readFromFile(inputFile);
            } catch (Exception ex) {
                throw new RuntimeException("Problem loading "
                        + this.requiredType.getName() + " object from file '"
                        + inputFile.getName() + "':\n" + ex.getMessage(), ex);
            }
            return result;
        } else {
            throw new RuntimeException(
                    "Could not materialize object of required type "
                            + this.requiredType.getName() + ", found "
                            + this.currentValue.getClass().getName()
                            + " instead.");
        }
    }