Model Driven Engineering (MDE) is a software development approach based on the use of models as essential artifacts. In the ideal scenario, source code is automatically generated from models by steps of transformations defined by mapping functions. A metamodel is a special type of model that describes the syntax of a modeling language. They are important because mapping functions reference their elements to define transformations, allowing the application of MDE. This paper proposes an extension of a metamodel of a domain specific modeling language for adaptive programs. This extension includes metaclasses, properties and constraints for specifying adaptive functions. An existing mapping function, which generates partial source code in BADAL language, was then updated to consider the new metamodel elements, becoming able to generate code for adaptive functions from the model specification. The resulting metamodel and mapping function were used as input to generate a CASE tool for adaptive programs, allowing the use of MDE in a higher level of abstraction than before for this class of application.