Documentation
¶
Overview ¶
Package javaast provides shared Java AST traversal utilities for test framework parsers.
Index ¶
- Constants
- func GetAnnotationArgument(annotation *sitter.Node, source []byte) string
- func GetAnnotationName(annotation *sitter.Node, source []byte) string
- func GetAnnotations(modifiers *sitter.Node) []*sitter.Node
- func GetClassBody(node *sitter.Node) *sitter.Node
- func GetClassName(node *sitter.Node, source []byte) string
- func GetMethodName(node *sitter.Node, source []byte) string
- func GetModifiers(node *sitter.Node) *sitter.Node
- func HasAnnotation(modifiers *sitter.Node, source []byte, annotationName string) bool
Constants ¶
const ( NodeClassDeclaration = "class_declaration" NodeMethodDeclaration = "method_declaration" NodeAnnotation = "annotation" NodeMarkerAnnotation = "marker_annotation" NodeModifiers = "modifiers" NodeIdentifier = "identifier" NodeFormalParameters = "formal_parameters" NodeClassBody = "class_body" NodeAnnotationArgumentList = "annotation_argument_list" )
Java AST node types.
Variables ¶
This section is empty.
Functions ¶
func GetAnnotationArgument ¶
GetAnnotationArgument extracts the annotation argument value. For @DisplayName("My Test"), returns "My Test".
func GetAnnotationName ¶
GetAnnotationName extracts the simple annotation name (e.g., "Test" from @Test or @org.junit.jupiter.api.Test). For scoped identifiers, returns only the simple name (last segment).
func GetAnnotations ¶
GetAnnotations extracts all annotation nodes from a modifiers node.
func GetClassBody ¶
GetClassBody returns the class body node from a class_declaration.
func GetClassName ¶
GetClassName extracts the class name from a class_declaration node.
func GetMethodName ¶
GetMethodName extracts the method name from a method_declaration node.
func GetModifiers ¶
GetModifiers returns the modifiers node from a method or class declaration.
Types ¶
This section is empty.