Mobile environments are characterized by resource fluctuations and limitations, and variations in user preferences. Therefore mobile applications need to be adaptive to retain usability, usefulness and reliability. In our approach to support adaptivity, we combine context awareness, reflection and component composition planning. The planning is done by generic middleware and supports dynamic discovery, utility-based and context-aware evaluation, and selection of the best implementation alternative of a given mobile application. In this paper we present a formal model of our approach and use this model to show the expressiveness of utility-based adaptation policies. To demonstrate the feasibility and expressiveness of our approach we include a case study based on a real adaptive application built using our model and middleware.