Skip to content

Instantly share code, notes, and snippets.

@osama-raddad
Created August 11, 2021 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save osama-raddad/58dbab0094f77cdbc8401b1494784dfc to your computer and use it in GitHub Desktop.
Save osama-raddad/58dbab0094f77cdbc8401b1494784dfc to your computer and use it in GitHub Desktop.
val namewarehouse = warehouse(Accessibility.LOCAL) {
this add module {
this add factory(contract = Name::class) {
this constructor { FirstName() }
this name "osa"
}
this add factory(contract = Name::class) {
this constructor { FirstName() }
this name "first"
this type Type.SINGLETON
}
this add factory(contract = Name::class) {
constructor { LastName() }
this name "last"
}
this add factory {
this constructor { FirstName() }
}
this add factory {
constructor { LastName() }
}
this add factory {
constructor { FullName(param(), param()) }
}
}
}
val userIDwarehouse = warehouse(Accessibility.Public) {
this add module {
this add factory {
this constructor { 12 }
this name "age"
}
}
}
val userwarehouse = warehouse(scope = Scope.CONSUMER) {
this add namewarehouse
this add userIDwarehouse
}
val consumerServiceLocator = warehouse(scope = Scope.CONSUMER) {
this add userwarehouse
this add module {
this add factory {
constructor { Access.ADMIN }
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment