org.octopusden.octopus.vcsfacade.dto.HashOrRefOrDate.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vcs-facade Show documentation
Show all versions of vcs-facade Show documentation
Octopus module: vcs-facade
The newest version!
package org.octopusden.octopus.vcsfacade.dto
import java.util.Date
import org.octopusden.octopus.vcsfacade.client.common.exception.ArgumentsNotCompatibleException
sealed class HashOrRefOrDate {
class HashOrRefValue(val value: String) : HashOrRefOrDate()
class DateValue(val value: Date) : HashOrRefOrDate()
companion object {
fun create(hashOrRef: String?, date: Date?) = if (hashOrRef != null) {
if (date != null) {
throw ArgumentsNotCompatibleException("'hashOrRef' and 'date' can not be used together")
}
HashOrRefValue(hashOrRef)
} else if (date != null) {
DateValue(date)
} else null
}
}