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

org.ekrich.config.ConfigSyntax.scala Maven / Gradle / Ivy

/**
 *   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)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy