Package de.idos.updates.configuration

Source Code of de.idos.updates.configuration.FallbackVersionDiscovery

package de.idos.updates.configuration;

import de.idos.updates.NullVersion;
import de.idos.updates.Version;
import de.idos.updates.VersionDiscovery;
import de.idos.updates.store.ProgressReport;

public class FallbackVersionDiscovery implements VersionDiscovery {
  private VersionDiscovery wrapped;
  private Version fallback;

  public FallbackVersionDiscovery(VersionDiscovery wrapped, Version fallback) {
    this.wrapped = wrapped;
    this.fallback = fallback;
  }

  @Override
  public Version getLatestVersion() {
    Version latestVersion = wrapped.getLatestVersion();
    if (latestVersion.isEqualTo(new NullVersion())) {
      return fallback;
    }
    return latestVersion;
  }

  @Override
  public void reportAllProgressTo(ProgressReport report) {
    wrapped.reportAllProgressTo(report);
  }
}
TOP

Related Classes of de.idos.updates.configuration.FallbackVersionDiscovery

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.