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")) ) )
- Alphabetic
- By Inheritance
- builders
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
trait
ObjectClassDefinitionConvenience extends AnyRef
Adds some convenience methods to the given object class definition.
-
class
SingleMetaTypeProvider extends MetaTypeProvider
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
-
object
ElementaryAttribute
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 )
-
object
ListAttribute
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" )
-
object
ObjectClass
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.