User Tools

Site Tools


runtime-adaptation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
runtime-adaptation [2018/08/18 13:22]
barryfp [Adaptation example]
runtime-adaptation [2019/07/24 13:19] (current)
barryfp
Line 14: Line 14:
 The ''​adaptRequiredInterface''​ function is used to adapt required interfaces. It re-wires a component'​s required interface from its current connection to a given component to instead point to the provided interface of a different component. All object instances sourced via that required interface are immediately adapted to the new implementation from the new provided interface. This is the most common kind of adaptation. The ''​adaptRequiredInterface''​ function is used to adapt required interfaces. It re-wires a component'​s required interface from its current connection to a given component to instead point to the provided interface of a different component. All object instances sourced via that required interface are immediately adapted to the new implementation from the new provided interface. This is the most common kind of adaptation.
  
-The ''​adaptObject''​ function is used to adapt one specific object to a different implementation. This function should only be used with dynamically created objects (i.e. using ''​new MyObject() from c :< MyObject''​)+The ''​adaptObject''​ function is used to adapt one specific object to a different implementation. This function should only be used with dynamically created objects (i.e. using ''​new MyObject() from c''​)
  
 ====== Adaptation example ====== ====== Adaptation example ======
  
-Here we provide a complete example of dynamically building a system and adapting it, using the above adaptation API.+Here we provide a complete example of dynamically building a system and adapting it, using the above adaptation API. You can download the entire project as a {{ :​adaptation.zip |single zip here}}, or follow the below steps to get individual files.
  
 Create a new project directory with the usual resources folder. Create a new project directory with the usual resources folder.
Line 86: Line 86:
  
  //bind our required interface to its initial configuration  //bind our required interface to its initial configuration
- dana.rewire(myComponent :> "​Counter",​ variantA ​:< "​Counter"​)+ myComponent.wire("​Counter",​ variantA"​Counter"​)
  
  Core myObject = new Core() from myComponent  Core myObject = new Core() from myComponent
runtime-adaptation.1534612953.txt.gz ยท Last modified: 2018/08/18 13:22 by barryfp