Package

domino.scala_osgi_metatype

builders

Permalink

package builders

Contains builder objects for easily creating Scala OSGi metatypes.

Example

The following example demonstrates how you can describe configuration parameters for a service.

import domino.scala_osgi_metatype.builders._

val myObjectClass = ObjectClass(
  id = "domino.my_service",
  name = "My configurable service",
  requiredAttributes = List(
    ElementaryAttribute[Int](id = "size", name = "Size", default = Some(5)),
    ElementaryAttribute[String](id = "user", name = "User", default = Some("root"))
  )
)
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. builders
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait ObjectClassDefinitionConvenience extends AnyRef

    Permalink

    Adds some convenience methods to the given object class definition.

  2. class SingleMetaTypeProvider extends MetaTypeProvider

    Permalink

    A meta type provider which provides an object class definition for one id.

    A meta type provider which provides an object class definition for one id. Ignores the language.

Value Members

  1. object ElementaryAttribute

    Permalink

    Convenient builder for elementary attribute definitions without advanced validation (type validation is done).

    Convenient builder for elementary attribute definitions without advanced validation (type validation is done).

    Examples

    // Minimum
    ElementaryAttribute[Int](id = "size")
    
    // Maximum
    ElementaryAttribute[Int](
      id = "size",
      name = "Size",
      description = "Size of the container",
      default = 5,
      options = List(
        "Small" -> 2,
        "Medium" -> 5,
        "Large" -> 10
    )
  2. object ListAttribute

    Permalink

    Convenient builder for list attribute definitions without advanced validation (type validation is done).

    Convenient builder for list attribute definitions without advanced validation (type validation is done).

    Examples

    // Minimum
    ListAttribute[String](id = "allowedFruits")
    
    // Maximum
    ListAttribute[String](
      id = "allowedFruits",
      name = "Allowed fruits",
      description = "These fruits are allowed",
      default = List("apple", "orange"),
      options = List(
        "Apple" -> "apple",
        "Orange" -> "orange",
        "Plum" -> "plum",
        "Banana" -> "banana"
    )
  3. object ObjectClass

    Permalink

    Convenient builder for object class definitions.

    Convenient builder for object class definitions.

    Examples

    // Minimum (though I strongly advise to provide a name as well)
    ObjectClass(
      id = "domino.my_service",
      requiredAttributes = List(
        ElementaryAttribute[Int](id = "size")
      )
    )
    
    // Maximum
    ObjectClass(
      id = "domino.my_service",
      name = "My configurable service",
      description = "A service which is configurable",
      requiredAttributes = List(
        ElementaryAttribute[Int](id = "size", name = "Size", default = Some(5)),
        ElementaryAttribute[String](id = "user", name = "User", default = Some("root"))
      ),
      optionalAttributes = List(
        ListAttribute[String](id = "allowedFruits")
      )
    )
    Note

    I've decided not to create a named case class extending ObjectClassDefinition because it would cause name/type conflicts. Moreover, the named class wouldn't add any benefits and would be just another class name to wonder about.

Inherited from AnyRef

Inherited from Any

Ungrouped