domain

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalClass added in v0.2.2

func MarshalClass(c Class, t string) protocol.Part

func MarshalSuggestion added in v0.2.2

func MarshalSuggestion(s OldSuggestion) protocol.Part

Types

type Artifacts added in v0.2.2

type Artifacts struct {
	Descr       *Description
	Classes     []Class
	Suggestions []Suggestion
}

func UnmarshalArtifacts added in v0.2.2

func UnmarshalArtifacts(msg *protocol.Message) (*Artifacts, error)

func (*Artifacts) Marshal added in v0.2.2

func (a *Artifacts) Marshal() *protocol.MessageSendParams

type Class

type Class interface {
	Name() string
	Content() string
	Path() string
	SetContent(content string) error
}

Class represents a code or text entity with a name and content.

func NewInMemoryClass added in v0.2.2

func NewInMemoryClass(name, path, content string) Class

NewInMemoryClass creates a new Class instance with the given name and content.

func UnmarshalClass added in v0.2.2

func UnmarshalClass(part protocol.Part) (Class, error)

type Critic

type Critic interface {
	Review(job *Job) (*Artifacts, error)
}

Critic represents an interface to review a class and provide suggestions.

type Description added in v0.2.2

type Description struct {
	Text string
	Meta map[string]any
}

func UnmarshalDescription added in v0.2.2

func UnmarshalDescription(part protocol.Part) (*Description, error)

func (*Description) Marshal added in v0.2.2

func (d *Description) Marshal() protocol.Part

type FSClass added in v0.2.2

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

FSClass represents a Java class file stored in the filesystem.

func NewFSClass added in v0.2.2

func NewFSClass(name, path string) *FSClass

NewFSClass creates a new FilesystemClass with the given name, path, and content.

func (*FSClass) Content added in v0.2.2

func (c *FSClass) Content() string

func (*FSClass) Name added in v0.2.2

func (c *FSClass) Name() string

func (*FSClass) Path added in v0.2.2

func (c *FSClass) Path() string

func (*FSClass) SetContent added in v0.2.2

func (c *FSClass) SetContent(content string) error

SetContent updates the content of the Java class file and writes it to the filesystem.

type FSProj added in v0.2.2

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

FSProj represents a project stored in the filesystem.

func NewFilesystem added in v0.2.2

func NewFilesystem(path string) *FSProj

NewFilesystem creates a new FilesystemProject with the given path.

func (*FSProj) Classes added in v0.2.2

func (p *FSProj) Classes() ([]Class, error)

Classes retrieves all Java classes in the project directory and its subdirectories.

func (*FSProj) String added in v0.2.2

func (p *FSProj) String() string

String returns the string representation of the FilesystemProject.

type Facilitator

type Facilitator interface {
	Refactor(job *Job) (*Artifacts, error)
}

Facilitator represents an interface to refactor tasks into multiple classes.

type Fixer

type Fixer interface {
	Fix(job *Job) (*Artifacts, error)
}

Fixer represents an interface to fix a class based on suggestions and an example.

type InMemoryProject added in v0.2.2

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

InMemoryProject is an implementation of Project that stores its classes in memory.

func (*InMemoryProject) Classes added in v0.2.2

func (i *InMemoryProject) Classes() ([]Class, error)

Classes retrieves all Java classes in the in-memory project.

func (*InMemoryProject) String added in v0.2.2

func (i *InMemoryProject) String() string

String returns a string representation of the in-memory project.

type Job added in v0.2.2

type Job struct {
	Descr       *Description
	Classes     []Class
	Suggestions []Suggestion
	Examples    []Class
}

func UnmarshalJob added in v0.2.2

func UnmarshalJob(msg *protocol.Message) (*Job, error)

func (*Job) Marshal added in v0.2.2

func (j *Job) Marshal() *protocol.MessageSendParams

func (*Job) Param added in v0.2.2

func (j *Job) Param(key string) (any, bool)

type MirrorProject added in v0.2.2

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

MirrorProject decorates FilesystemProject with a mirror location to avoid modifying the original.

func NewMirrorProject added in v0.2.2

func NewMirrorProject(original *FSProj, mirrorPath string) (*MirrorProject, error)

NewMirrorProject creates a mirror of the original FilesystemProject at the given path.

func (*MirrorProject) Classes added in v0.2.2

func (m *MirrorProject) Classes() ([]Class, error)

Classes retrieves all Java classes from the mirrored project.

type OldSuggestion added in v0.2.2

type OldSuggestion interface {
	Text() string
}

OldSuggestion represents a proposed improvement or fix for a class.

func NewOldSuggestion added in v0.2.2

func NewOldSuggestion(text string) OldSuggestion

NewOldSuggestion creates a new Suggestion instance with the given text.

func UnmarshalOldSuggestion added in v0.2.2

func UnmarshalOldSuggestion(part protocol.Part) (OldSuggestion, error)

type Project added in v0.2.2

type Project interface {
	// Classes retrieves all Java classes within the project.
	Classes() ([]Class, error)
}

Project represents an interface for managing Java classes within a project.

func NewInMemory added in v0.2.2

func NewInMemory(classes ...Class) Project

NewInMemory creates a new in-memory project with the given map of file names to Java class content.

func NewMock added in v0.2.2

func NewMock() Project

NewMock creates a mock project with predefined content for testing purposes.

type Reviewer added in v0.2.2

type Reviewer interface {
	Review() (*Artifacts, error)
}

Reviewer represents an interface for a reviewer that can review changes made.

type Suggestion

type Suggestion struct {
	ClassPath string
	Text      string
}

func NewSuggestion

func NewSuggestion(text, path string) *Suggestion

func UnmarshalSuggestion added in v0.2.2

func UnmarshalSuggestion(part protocol.Part) (*Suggestion, error)

func (*Suggestion) Marshal added in v0.2.2

func (s *Suggestion) Marshal() protocol.Part

func (*Suggestion) String added in v0.2.2

func (s *Suggestion) String() string

type Task

type Task interface {
	Description() string
	Classes() []Class
	Param(name string) (string, bool)
}

Task represents a unit of work that contains classes and associated parameters.

func NewTask

func NewTask(description string, classes []Class, parameters map[string]any) Task

NewTask creates a new Task instance with the given description, classes, and parameters.

Jump to

Keyboard shortcuts

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