client

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package client provides functionality for working with Java source files in a project structure.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilesystemJavaClass

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

FilesystemJavaClass represents a Java class file stored in the filesystem.

func (*FilesystemJavaClass) Content

func (c *FilesystemJavaClass) Content() string

Content returns the content of the Java class file.

func (*FilesystemJavaClass) Name

func (c *FilesystemJavaClass) Name() string

Name returns the name of the Java class.

func (*FilesystemJavaClass) SetContent

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

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

type FilesystemProject

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

FilesystemProject represents a project stored in the filesystem.

func NewFilesystemProject

func NewFilesystemProject(path string) *FilesystemProject

NewFilesystemProject creates a new FilesystemProject with the given path.

func (*FilesystemProject) Classes

func (p *FilesystemProject) Classes() ([]JavaClass, error)

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

func (*FilesystemProject) String added in v0.1.0

func (p *FilesystemProject) String() string

String returns the string representation of the FilesystemProject.

type InMemoryJavaClass

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

InMemoryJavaClass is an implementation of JavaClass that stores its data in memory.

func (*InMemoryJavaClass) Content

func (i *InMemoryJavaClass) Content() string

Content retrieves the content of the in-memory Java class.

func (*InMemoryJavaClass) Name

func (i *InMemoryJavaClass) Name() string

Name retrieves the name of the in-memory Java class.

func (*InMemoryJavaClass) SetContent

func (i *InMemoryJavaClass) SetContent(content string) error

SetContent updates the content of the in-memory Java class.

type InMemoryProject

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

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

func (*InMemoryProject) Classes

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

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

func (*InMemoryProject) String added in v0.1.0

func (i *InMemoryProject) String() string

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

type JavaClass

type JavaClass interface {
	// Name returns the name of the Java class.
	Name() string
	// Content retrieves the content of the Java class.
	Content() string
	// SetContent sets the content of the Java class.
	SetContent(content string) error
}

JavaClass represents an interface for a single Java class.

type MirrorProject added in v0.2.0

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.0

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

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

func (*MirrorProject) Classes added in v0.2.0

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

Classes retrieves all Java classes from the mirrored project.

type Params added in v0.2.0

type Params struct {
	Provider    string
	Token       string
	Playbook    string
	MockProject bool
	Debug       bool
	Stats       bool
	Format      string
	Soutput     string
	Input       string
	Output      string
	Log         io.Writer
}

Params holds the configuration parameters for Refrax commands.

func NewMockParams added in v0.2.0

func NewMockParams() *Params

NewMockParams creates a new Params object with mock settings.

type Project

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

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

func NewInMemoryProject

func NewInMemoryProject(files map[string]string) Project

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

func NewMockProject

func NewMockProject() Project

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

func Refactor

func Refactor(params *Params) (Project, error)

Refactor initializes the refactoring process for the given project.

func SingleClassProject

func SingleClassProject(name, content string) Project

SingleClassProject creates a project containing a single Java class with the provided name and content.

type RefraxClient

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

RefraxClient represents a client used for refactoring projects.

func NewRefraxClient

func NewRefraxClient(params *Params) *RefraxClient

NewRefraxClient creates a new instance of RefraxClient.

func (*RefraxClient) Refactor

func (c *RefraxClient) Refactor(proj Project) (Project, error)

Refactor performs refactoring on the given project using the RefraxClient.

Jump to

Keyboard shortcuts

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