; Java pattern detection queries
; Captures: @node (pattern site), @name (identifier)

; Singleton: private constructor
(class_declaration
  name: (identifier) @name
  body: (class_body
    (constructor_declaration
      (modifiers) @_mods
      (#match? @_mods "private")))) @node

; Factory: static method named create/build/of/from
(method_declaration
  (modifiers) @_mods
  name: (identifier) @name
  (#match? @_mods "static")
  (#match? @name "^(create|build|of|from|new)")) @node

; Builder class
(class_declaration
  name: (identifier) @name
  (#match? @name "Builder")) @node

; DI/framework annotations
(marker_annotation
  name: (identifier) @name
  (#match? @name "^(Singleton|Component|Service|Repository|Controller|Bean)$")) @node
