Package

com.github.kiran002.kissconfig.config

api

Permalink

package api

Visibility
  1. Public
  2. All

Type Members

  1. trait ResolutionStrategy extends AnyRef

    Permalink

    Interface used to define a ResolutionStrategy.

    Interface used to define a ResolutionStrategy.

    Naming conventions can be different going from scala to hocon config. ResolutionStrategy defines the api that is used for the translation of scala field names to hocon config keys

    Example:
    1. case class AddB() extends ResolutionStrategy {
           override def resolve(s: String): String = s+"B"
       }

      This example shows how to define a simple AddB resolution strategy. The resolution strategy simply adds 'B' to the end fo the field name.

    Note

    More example are available under com.github.kiran002.kissconfig.config.impl.ResolutionStrategies

    ,

    This is only an example for how to define a resolution strategy, this should never be used in your application.

  2. trait TypeHelper extends AnyRef

    Permalink

    Interface used to define a TypeHelper.

    Interface used to define a TypeHelper.

    Given a type (T), the TypeHelper is expected to be able

    1. Extract configuration value from the config object 2. Parse the value to the target type
    Example:
    1. class StringTypeHelper extends TypeHelper {
          private val stringExtractor: Input => Any  = x => x.config.getString(x.configKey.get)
           override def canHandle(objType: universe.Type): Boolean =
                         objType.typeSymbol==universe.typeOf[String].typeSymbol
          override def get(objType: universe.Type): Input => Any = stringExtractor
       }
    Note

    More example are available under com.github.kiran002.kissconfig.config.impl

Value Members

  1. object ResolutionStrategy

    Permalink

    Static Wrapper for ResolutionStrategy that can used to register new implementation of Resolution Strategy during runtime

    Static Wrapper for ResolutionStrategy that can used to register new implementation of Resolution Strategy during runtime

    Maximum one resolution strategy is supported at a time If no Resolution Strategy is provided the fieldname is used as the config key

  2. object TypeHelper

    Permalink

    Static Wrapper for TypeHelper that can used to register new implementation of TypeHelper during runtime

    Static Wrapper for TypeHelper that can used to register new implementation of TypeHelper during runtime

    Any Number of TypeHelper can be registered, the helper registered latest has the highest precedence when executing

Ungrouped