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

org.fernice.flare.style.properties.custom.Name.kt Maven / Gradle / Ivy

/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

package org.fernice.flare.style.properties.custom

import org.fernice.std.Err
import org.fernice.std.Ok
import org.fernice.std.Result

data class Name(val value: String) : Comparable {

    override fun compareTo(other: Name): Int {
        return value.compareTo(other.value)
    }

    override fun toString(): String = "--$value"

    companion object {

        fun parse(value: String): Result {
            return if (value.startsWith("--")) {
                Ok(Name(value.substring(2)))
            } else {
                Err()
            }
        }
    }
}








© 2015 - 2025 Weber Informatics LLC | Privacy Policy