In the field of software engineering, the term class invariants is known as a valuable term employed to delineate the semantic of UML class diagram elements (attributes and relationships) and must be held throughout the life-time of instances of the class. Refactoring, the activities of re-distributing classes, attributes and methods across the class hierarchy, is a powerful technique that is used to improve the quality of software systems. Performing refactoring on UML class diagrams obviously requires a special investigation of invariant-preserving on the refactored models. In this paper, we propose an approach to preserve class invariants in refactoring UML models. In order to achieve this aim, we first formalize the class diagram along with class invariants by mathematical notations. We then constitute the rules for five refactoring operations (deal with class hierarchies) in such a way to guarantee class invariants as well as proving correctness of the refactoring rules. Finally, the paper also makes provision of the proposed approach for practical applications in software re-engineering development process.