java

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2026 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package java provides a documentation source adapter that reads Java source code from a local clone of a GitHub repository. It parses raw Java source via tree-sitter to extract classes, interfaces, enums, records, annotations, methods, fields, and JavaDoc without making any network calls during parsing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBladeFactory

func NewBladeFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewBladeFactory creates a Source for the Blade lightweight MVC framework.

func NewCommonsLangFactory

func NewCommonsLangFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewCommonsLangFactory creates a Source for Apache Commons Lang.

func NewDropwizardFactory

func NewDropwizardFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewDropwizardFactory creates a Source for the Dropwizard framework.

func NewGrailsFactory

func NewGrailsFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewGrailsFactory creates a Source for the Grails framework.

func NewGuavaFactory

func NewGuavaFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewGuavaFactory creates a Source for Google Guava.

func NewHelidonFactory

func NewHelidonFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewHelidonFactory creates a Source for the Helidon cloud-native framework.

func NewHibernateFactory

func NewHibernateFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewHibernateFactory creates a Source for Hibernate ORM.

func NewJUnit5Factory

func NewJUnit5Factory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewJUnit5Factory creates a Source for JUnit 5.

func NewJacksonFactory

func NewJacksonFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewJacksonFactory creates a Source for the Jackson JSON library.

func NewJavalinFactory

func NewJavalinFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewJavalinFactory creates a Source for the Javalin framework.

func NewJoobyFactory

func NewJoobyFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewJoobyFactory creates a Source for the Jooby web framework. Replaces Ktor, which is written in Kotlin and cannot be indexed by the Java adapter.

func NewKafkaFactory

func NewKafkaFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewKafkaFactory creates a Source for Apache Kafka.

func NewLogbackFactory

func NewLogbackFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewLogbackFactory creates a Source for Logback.

func NewMicronautFactory

func NewMicronautFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewMicronautFactory creates a Source for the Micronaut framework.

func NewMockitoFactory

func NewMockitoFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewMockitoFactory creates a Source for Mockito.

func NewNettyFactory

func NewNettyFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewNettyFactory creates a Source for Netty.

func NewOpenJDKFactory

func NewOpenJDKFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewOpenJDKFactory creates a Source for the OpenJDK standard library.

func NewPlayFactory

func NewPlayFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewPlayFactory creates a Source for the Play Framework.

func NewQuarkusFactory

func NewQuarkusFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewQuarkusFactory creates a Source for the Quarkus framework.

func NewRatpackFactory

func NewRatpackFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewRatpackFactory creates a Source for the Ratpack framework.

func NewSparkFactory

func NewSparkFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewSparkFactory creates a Source for the Spark Java framework.

func NewSpringBootFactory

func NewSpringBootFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewSpringBootFactory creates a Source for Spring Boot.

func NewSpringFrameworkFactory

func NewSpringFrameworkFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewSpringFrameworkFactory creates a Source for the Spring Framework.

func NewStrutsFactory

func NewStrutsFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewStrutsFactory creates a Source for the Apache Struts framework.

func NewVertxFactory

func NewVertxFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewVertxFactory creates a Source for the Vert.x toolkit.

Types

type Config

type Config struct {
	// Owner is the GitHub repository owner (e.g., "spring-projects").
	Owner string
	// Repo is the GitHub repository name (e.g., "spring-framework").
	Repo string
	// LibraryID is the canonical library ID (e.g., "java/spring-framework").
	LibraryID string
	// Name is the display name (e.g., "Spring Framework").
	Name string
	// Description is a short description of the library.
	Description string
	// SourceURL is the GitHub URL of the project.
	SourceURL string
	// SourceRoots are the root directories to walk for Java source files,
	// relative to the repository root. If empty, defaults to ["src/main/java"].
	SourceRoots []string
	// ExcludePatterns are glob patterns (relative to repo root) to exclude
	// from discovery. Common: ["**/test/**", "**/internal/**"].
	ExcludePatterns []string
	// TagFilter filters valid tags during version resolution.
	TagFilter func(string) bool
}

Config holds the configuration for a Java source adapter. Each Java library (Spring, Hibernate, JUnit, etc.) uses its own Config.

type Option

type Option func(*Source)

Option customises a Source at construction time.

func WithRef

func WithRef(ref string) Option

WithRef sets the git ref (tag or branch) for source-code links.

type Source

type Source struct {
	// contains filtered or unexported fields
}

Source is a documentation source adapter for Java libraries.

func New

func New(repoPath string, cfg Config, opts ...Option) *Source

New constructs a new Java Source pointing at a local clone.

func (*Source) DetectWrapper

func (s *Source) DetectWrapper(method *source.Method) (bool, string, string)

DetectWrapper analyzes a method's source code for delegation patterns.

func (*Source) DiscoverEntities

func (s *Source) DiscoverEntities(ctx context.Context, fetch source.FetchFunc) ([]string, error)

DiscoverEntities walks the local repository and returns a sorted list of entity identifiers. Each identifier is of the form filepath#ClassName (or filepath#Outer.Inner for inner classes).

func (*Source) ID

func (s *Source) ID() string

ID returns the canonical library ID.

func (*Source) Meta

func (s *Source) Meta() source.LibraryMeta

Meta returns metadata for the library record.

func (*Source) ParseEntity

func (s *Source) ParseEntity(ctx context.Context, entityID string, content []byte) (*source.Entity, []string, error)

ParseEntity parses a single entity from file content, identified by entityID.

func (*Source) ParseMethod

func (s *Source) ParseMethod(ctx context.Context, methodID string, content []byte) (*source.Method, error)

ParseMethod parses a single method/function from file content. The methodID has the form: filepath#ClassName::methodName(paramTypes)

func (*Source) ParseSourceCode

func (s *Source) ParseSourceCode(entityID string, content []byte) (string, error)

ParseSourceCode extracts the source code for a specific entity or method.

func (*Source) ResolveWrapperURL

func (s *Source) ResolveWrapperURL(targetName, targetKind, entitySlug string) string

ResolveWrapperURL constructs the identifier to fetch the wrapped target's source.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL