Annotations
Learn how to use annotations in BoxLang for metadata-driven programming with classes, properties, and functions
🎯 Where Annotations Can Be Used
📝 Annotation Syntax
Standalone Annotations
@annotationName
class MyClass {
}
@inject
property userService;
@cached
function getData() {
}Inline Annotations
💡 Annotation Values
No Value (Empty String)
String Values
Boolean Values
Array Literal Values
Struct Literal Values
Nested Literals
📋 Annotation Format Examples
🔍 Runtime Metadata Access
Using getMetadata()
Using getClassMetadata()
Using $bx.meta
🎨 Common Annotation Patterns
Dependency Injection
Caching
Security & Authorization
Validation
Framework Integration
🔧 Custom Annotations
💻 Complete Example
🎯 Best Practices
📚 Related Topics
Last updated
Was this helpful?
