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

org.octopusden.octopus.vcsfacade.dto.HashOrRefOrDate.kt Maven / Gradle / Ivy

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
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy