https://kotlinlang.org logo
#getting-started
Title
# getting-started
a

anlex N

03/24/2024, 4:51 AM
https://kotlinlang.org/docs/classes.html is you says annotation equal to
@Inject
? is you says annotation equal to Decorator (another tech word)? why not use Decorator word?
r

Ruckus

03/24/2024, 6:29 AM
> is you says annotation equal to
@Inject
? > I'm not 100% sure what you're asking, but I'm this example
@Inject
is an annotation on the `Customer`'s constructor. > is you says annotation equal to Decorator (another tech word)? > I guess that depends on what you mean by decorator. That word is used different ways in different languages. > why not use Decorator word? > Why should they use decorator? What's wrong with annotation?
a

anlex N

03/24/2024, 6:33 AM
is it equal to Typescript Decorator ?
r

Ruckus

03/24/2024, 6:38 AM
There's some overlap, but they're not the exact same. Typescript decorators have some meta programming capabilities, whereas annotations are just meta data. (Those annotations can be used in meta programming and code generation, but that is handled in some sort of annotation processor, and not in the annotation itself.)
j

Jacob

03/24/2024, 12:32 PM
The meaning of @Inject is not important for these docs. They could have chosen @Foo
g

gildor

03/26/2024, 7:16 AM
It's just an example, and it uses popular javax.inject.Inject annotation, because it's one of more whide-spreaded examples of annotations used by man JSR-330 compatible dependency injection frameworks, but in this case, yes, any annotation can work, this one just real-life example