You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**Multiple runtimes** - Web servers, CLI, AWS Lambda, Docker
21
+
-**Multiple runtimes** - Web servers, CLI, AWS Lambda, Docker, and more
21
22
22
23
## Class Syntax
23
24
24
25
### Basic Class Structure
25
26
27
+
Annotations are supported in Boxlang using the `@` symbol. The `@inject` annotation is used for dependency injection by a framework. The annotation can be applied to classes, properties and functions. They can have no value, or the value within `( )` can be a boolean, integer, string, array or struct.
Automatic getters and setters are supported by default. You can enable or disable them at the class level with the `@accessors` annotation, but they are on by default for all properties. You can also define custom getters and setters if you need custom logic.
99
+
100
+
Implicit invokers are also on by default, allowing you to call getters and setters as if they were properties or functions without the `get`/`set` prefix.
101
+
85
102
```boxlang
86
-
// Enable automatic getters/setters
87
-
@accessors true
88
-
class User {
103
+
class {
89
104
property name="firstName";
90
105
property name="lastName";
91
106
property name="email";
92
107
}
93
108
94
109
// Usage
95
110
user = new User()
111
+
// Use setters and getters
96
112
user.setFirstName( "Luis" )
97
113
user.setLastName( "Majano" )
98
114
var name = user.getFirstName()
115
+
// Use implicit invokers
116
+
user.firstName = "Luis"
117
+
user.lastName = "Majano"
118
+
var name = user.firstName
99
119
```
100
120
101
121
## Lambda Expressions
@@ -189,6 +209,12 @@ var result = stringBuffer.toString()
189
209
// Using new operator
190
210
var uuid = new java:java.util.UUID.randomUUID()
191
211
var dateFormatter = new java:java.text.SimpleDateFormat( "yyyy-MM-dd" )
0 commit comments