All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.digitalasset.daml.lf.LfVersions.scala Maven / Gradle / Ivy

There is a newer version: 1.18.2
Show newest version
// Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package com.daml.lf

import scalaz.NonEmptyList

abstract class LfVersions[V](versionsAscending: NonEmptyList[V])(protoValue: V => String) {

  protected val maxVersion: V = versionsAscending.last

  val acceptedVersions: List[V] = versionsAscending.list.toList

  private val acceptedVersionsMap: Map[String, V] =
    acceptedVersions.iterator.map(v => (protoValue(v), v)).toMap

  def isAcceptedVersion(version: String): Option[V] = acceptedVersionsMap.get(version)

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy