Answer Overflow Logo
Search Answer OverflowGitHubAdd Your Server
HomePopular
Topics

MC
Metalama Community•3y ago
Andreu

Does Metalama only support attributes?

I navigated in all Metalama documentation, but I want to override a method for all types that inherit from BusinessException. I don't want to use attributes because for my use case it's more natural to extend from a class.
3 Replies
Petr Onderka
Petr Onderka•3y ago
The easiest way to achieve that is to add the [Inheritable] attribute (documentation: https://doc.metalama.net/conceptual/aspects/aspect-inheritance) to the aspect. Here is an example: https://try.metalama.net/#N4IgZiBcDaoHZRABQE4HsDmKCGBbAdAMYDOIANCIYgK7ECWcGABALICmALtgDZ7b4AxHLjYB3NCgDW+AILEADm0IdiAbgA6cWg2bsuvXPyF4xE6QGE0AEzYa4m6AEk4ACzYo6XAEbc2AXU1CXmJiJgAZTBlubhkODg8vag42SCYAFQBPRTlFZU1gTSYipnlqHzpCJjQAN3cPGyZqtDorJgAhajpuKxylDgAKR17lDq6bFAAeRwA5EytMxQA+JkSx9wBKQuKCuGK9pjAJNmxCFyZ+6uwUJhEOF2smBhXO7vd8NKuMTnw9e6tiTa7fZFHbA4GrV4oWRWaoVNj4ADytRQ9TY-VufzITDgJjQYH6EQw63WdjBTAAvlsipT7ECitA0mxcPJeMkAnSmFYMjjcBUAPzhTD9QF7UFgyxwYhoXz4ADqHmSYQYaIAJOoQABRODJDyMG6cP5MYC3fgfFBfDg-A3Wcn4dUkzRU-YoTjUFC7E34VBoQhsNhWYWk4o0mkOQlRbjs7BeYjxE4cJhBbAhdraOBsEIagAevvkHDoaF2qWzufzhfyTqaLXaybY5mCxF+1mFRopmlDcCTKYlhBdyQ69HTmZzbDzBaLqcHGeIJdHZdpYqKVdaABF3HRalZ68nG9aA+tWyHyCBJIgOCByX5yUA
Andreu
AndreuOP•3y ago
Wow, incredibly helpful, thanks!
Gael Fraiteur
Gael Fraiteur•3y ago
There's also a video here: https://doc.metalama.net/videos/fabrics-and-inheritance
Metalama CommunityJoin
22Members
View on Discord

Did you find this page helpful?

Legal

TermsPrivacyCookiesEULA

About

DocsPricingAboutContributorsCommunitiesChangelogAll Posts
TwitterGitHubDiscord

© 2024 Hedgehog Software, LLC. All rights reserved.