callbackgen

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: CC0-1.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoxExpression

func BoxExpression(javaType, paramName string) string

BoxExpression returns the Java expression that boxes a primitive value. For object types it returns the parameter name unmodified.

func Generate

func Generate(specPath, outputDir string) error

Generate reads the spec and writes one Java adapter file per callback entry.

func IsPrimitive

func IsPrimitive(javaType string) bool

IsPrimitive returns true if the Java type is a primitive that needs boxing.

Types

type CallbackEntry

type CallbackEntry struct {
	// Class is the fully-qualified Java class or interface name.
	Class string `yaml:"class"`

	// Adapter is the generated adapter class name (unqualified).
	Adapter string `yaml:"adapter"`

	// Interface indicates whether the base type is a Java interface
	// (uses "implements") rather than a class (uses "extends").
	Interface bool `yaml:"interface"`

	// Methods lists the abstract methods to override.
	Methods []MethodEntry `yaml:"methods"`
}

CallbackEntry describes a single abstract class or interface that needs a generated Java adapter.

type MethodEntry

type MethodEntry struct {
	Name   string       `yaml:"name"`
	Params []ParamEntry `yaml:"params"`
}

MethodEntry describes a single abstract method to override.

type ParamEntry

type ParamEntry struct {
	Type string `yaml:"type"`
	Name string `yaml:"name"`
}

ParamEntry describes a single method parameter.

type Spec

type Spec struct {
	Callbacks []CallbackEntry `yaml:"callbacks"`
}

Spec is the top-level structure of the callbacks YAML spec.

func LoadSpec

func LoadSpec(path string) (*Spec, error)

LoadSpec reads and parses a callbacks YAML spec file.

Jump to

Keyboard shortcuts

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