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

org.ekrich.config.impl.ConfigInt.scala Maven / Gradle / Ivy

/**
 *   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 ConfigInt(
    origin: ConfigOrigin,
    val value: Int,
    originalText: String
) extends ConfigNumber(origin, originalText)
    with Serializable {
  override def valueType: ConfigValueType = ConfigValueType.NUMBER

  override def unwrapped: Integer = value

  override def transformToString: String = {
    val s = super.transformToString
    if (s == null) Integer.toString(value) else s
  }

  override def longValue: Long = value.toLong

  override def doubleValue: Double = value.toDouble

  override def newCopy(origin: ConfigOrigin) =
    new ConfigInt(origin, value, originalText)

  // serialization all goes through SerializedConfigValue
  @throws[ObjectStreamException]
  private def writeReplace(): jl.Object = new SerializedConfigValue(this)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy