org.ekrich.config.ConfigSyntax.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
import java.{lang => jl}
/**
* The syntax of a character stream (JSON, HOCON
* aka ".conf", or Java properties).
*
*/
final class ConfigSyntax private (name: String, ordinal: Int)
extends jl.Enum[ConfigSyntax](name, ordinal)
object ConfigSyntax {
/**
* Pedantically strict JSON format; no
* comments, no unexpected commas, no duplicate keys in the same object.
* Associated with the .json
file extension and
* application/json
Content-Type.
*/
final val JSON = new ConfigSyntax("JSON", 0)
/**
* The JSON-superset HOCON format. Associated with the .conf
file extension
* and application/hocon
Content-Type.
*/
final val CONF = new ConfigSyntax("CONF", 1)
/**
* Standard Java properties format. Associated with the .properties
* file extension and text/x-java-properties
Content-Type.
*/
final val PROPERTIES = new ConfigSyntax("PROPERTIES", 2)
private[this] final val _values: Array[ConfigSyntax] =
Array(JSON, CONF, PROPERTIES)
def values: Array[ConfigSyntax] = _values.clone()
def valueOf(name: String): ConfigSyntax =
_values.find(_.name == name).getOrElse {
throw new IllegalArgumentException("No enum const ConfigSyntax." + name)
}
}