org.ekrich.config.impl.ConfigLong.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sconfig_sjs1.0-RC2_2.13 Show documentation
Show all versions of sconfig_sjs1.0-RC2_2.13 Show documentation
Configuration library for Scala using HOCON files
The newest version!
/**
* Copyright (C) 2011-2012 Typesafe Inc.
*/
package org.ekrich.config.impl
import java.{lang => jl}
import java.io.ObjectStreamException
import java.io.Serializable
import org.ekrich.config.ConfigOrigin
import org.ekrich.config.ConfigValueType
@SerialVersionUID(2L)
final class ConfigLong(
origin: ConfigOrigin,
val value: Long,
originalText: String
) extends ConfigNumber(origin, originalText)
with Serializable {
override def valueType: ConfigValueType = ConfigValueType.NUMBER
override def unwrapped: jl.Long = value
override def transformToString: String = {
val s = super.transformToString
if (s == null) jl.Long.toString(value) else s
}
override def longValue: Long = value
override def doubleValue: Double = value.toDouble
override def newCopy(origin: ConfigOrigin) =
new ConfigLong(origin, value, originalText)
// serialization all goes through SerializedConfigValue
@throws[ObjectStreamException]
private def writeReplace(): jl.Object = new SerializedConfigValue(this)
}