Package

org.jaylib.scala.config

convert

Permalink

package convert

Contains the classes necessary to convert the configuration objects to strings and back.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. convert
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

  1. class ConversionException extends RuntimeException

    Permalink
  2. class TypeConversions extends AnyRef

    Permalink

    Converts a type to its string representation and back.

    Converts a type to its string representation and back. For creation of the type from a string the create_... methods are used.

    Automatically supported types are: $ - collection types (immutable preferred): List, Seq, Vector, Set $ - all classes deriving from Product, including case classes and tuples

    If a new type NewType shall be supported, the TypeConversions has to be extended with the create_NewType(str: String) method. The conversion to a string is simply done by calling the object's toString method - Strings themselves are surrounded by quotes.

    If a new type (or an existing one) shall change the conversion to a string, the appendString(Any, StringBuilder)-method has to be overridden.

    Example: extend TypeConversions for java.io.File, where its String representation is mapped to the file's absolute path

    val config = ConfigMacros.wrap(classOf[Config], props.getProperty, props.setProperty, new TypeConversions {
      def create_File(filename: String) = new File(filename)
      override def appendString(any: Any, buf: StringBuilder) {
        any match {
          case file: File => buf.append(file.getAbsolutePath)
          case any        => super.appendString(any, buf)
        }
      }
    })

Value Members

  1. object ConversionException extends Serializable

    Permalink
  2. object StringUtils

    Permalink
  3. object TypeConversions

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped