Java has AOP and extensively use Annotations (Attributes in .NET) and the approach there is definitely heavier than what you wrote above.