Skip to content

Commit b9cd3b8

Browse files
authored
Merge pull request #105 from codefuse-ai/change_readme
[doc] add comment for java's annotation lib file.
2 parents 3847be1 + f829034 commit b9cd3b8

File tree

1 file changed

+86
-7
lines changed

1 file changed

+86
-7
lines changed

language/java/lib/Annotation.gdl

+86-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
/**
2-
* @brief Describe an annotated relation.
2+
* @brief Relationship between annotation and annotated element
3+
* @corresponds Java AST: Connection between annotation node and target
4+
* @example
5+
* <pre>{@code
6+
* @interface Entity {}
7+
*
8+
* @Entity
9+
* class User {
10+
* @Id
11+
* private Long id;
12+
* }
13+
* }</pre>
314
*/
415
schema AnnotatedRelation extends AnnotatedRelationDO {
516

617
}
18+
719
impl AnnotatedRelation {
820
@data_constraint
921
@inline
@@ -38,9 +50,16 @@ impl AnnotatedRelation {
3850
}
3951
}
4052
}
53+
54+
55+
/**
56+
* @brief Base class for annotation data storage
57+
* @corresponds Java AST: Database structure for annotation nodes
58+
*/
4159
schema AnnotationDo {
4260
@primary id: int
4361
}
62+
4463
impl AnnotationDo {
4564
@data_constraint
4665
@inline
@@ -168,8 +187,18 @@ impl AnnotationDo {
168187
}
169188
}
170189
}
190+
191+
171192
/**
172-
* @brief An access annotation.
193+
* @brief Concrete annotation instance
194+
* @corresponds Java AST: Annotation application node
195+
* @example
196+
* <pre>{@code
197+
* @GetMapping("/users")
198+
* public List<User> getUsers() {
199+
* // method implementation
200+
* }
201+
* }</pre>
173202
*/
174203
schema Annotation extends AnnotationDo {
175204

@@ -370,8 +399,16 @@ impl AnnotationAccessArgumentDO {
370399
}
371400
}
372401
}
402+
403+
373404
/**
374-
* @brief An argument that applies to an annotation.
405+
* @brief Concrete annotation argument value
406+
* @corresponds Java AST: Argument value specification
407+
* @example
408+
* <pre>{@code
409+
* @Retry(maxAttempts = 3, delay = 1000L)
410+
* void process() {}
411+
* }</pre>
375412
*/
376413
schema AnnotationAccessArgument extends AnnotationAccessArgumentDO {
377414

@@ -515,8 +552,18 @@ impl AnnotationAccessArgument {
515552
}
516553
}
517554
}
555+
556+
518557
/**
519-
* @brief Represents an array used as a value of an annotation element. For example: @Endorsers({"Children", "Unscrupulous dentists"})
558+
* @brief Annotation array initializer
559+
* @example
560+
* <pre>{@code
561+
* @Authors({
562+
* @Author(name = "Alice"),
563+
* @Author(name = "Bob")
564+
* })
565+
* class Book {}
566+
* }</pre>
520567
*/
521568
schema AnnotationArrayInitializer extends AnnotationArrayInitializerDO {
522569

@@ -579,8 +626,17 @@ impl AnnotationArrayInitializer {
579626
}
580627
}
581628
}
629+
630+
582631
/**
583-
* @brief An annotation that applies to a declaration.
632+
* @brief Annotation type declaration
633+
* @example
634+
* <pre>{@code
635+
* @interface Scheduled {
636+
* String cron();
637+
* boolean enableRetry() default false;
638+
* }
639+
* }</pre>
584640
*/
585641
schema AnnotationDeclaration extends AnnotationDeclarationDO {
586642

@@ -622,8 +678,19 @@ impl AnnotationDeclaration {
622678
}
623679
}
624680
}
681+
682+
625683
/**
626-
* @brief A parameter that applied to a annotation declaration.
684+
* @brief Parameter definition in annotation type declarations
685+
* @corresponds Java AST: AnnotationTypeElementDeclaration node
686+
* @example
687+
* <pre>{@code
688+
* @interface TestConfig {
689+
* // Represents two parameters
690+
* int timeout() default 30; // AnnotationDeclarationParameter 1
691+
* String[] cases(); // AnnotationDeclarationParameter 2
692+
* }
693+
* }</pre>
627694
*/
628695
schema AnnotationDeclarationParameter extends AnnotationDeclarationParameterDO {
629696

@@ -688,8 +755,20 @@ impl AnnotationDeclarationParameter {
688755
}
689756
}
690757
}
758+
691759
/**
692-
* @brief Default value for an annotation parameter, if any.
760+
* @brief Default value specification for annotation parameters
761+
* @corresponds Java AST: AnnotationTypeElementDefaultValue node
762+
* @example
763+
* <pre>{@code
764+
* @interface TimeoutConfig {
765+
* // Parameter with default value
766+
* int duration() default 30; // ← This default clause
767+
*
768+
* // Parameter without default
769+
* String unit();
770+
* }
771+
* }</pre>
693772
*/
694773
schema AnnotationDeclarationParameterDefaultValue extends AnnotationDeclarationParameterDefaultValueDO {
695774

0 commit comments

Comments
 (0)