java

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2019 License: BSD-3-Clause Imports: 14 Imported by: 4

Documentation

Overview

Package java implements Java code generation from compiled VDL packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetPkgPathXlator

func SetPkgPathXlator(xlator func(path string) string)

SetPkgPathXlator sets the function used to translate a VDL package path into a Java package path.

Types

type JavaFileInfo

type JavaFileInfo struct {
	Dir  string
	Name string
	Data []byte
}

JavaFileInfo stores the name and contents of the generated Java file.

func Generate

func Generate(pkg *compile.Package, env *compile.Env) (ret []JavaFileInfo)

Generate generates Java files for all VDL files in the provided package, returning the list of generated Java files as a slice. Since Java requires that each public class/interface gets defined in a separate file, this method will return one generated file per struct. (Interfaces actually generate two files because we create separate interfaces for clients and servers.) In addition, since Java doesn't support global variables (i.e., variables defined outside of a class), all constants are moved into a special "Consts" class and stored in a separate file. All client bindings are stored in a separate Client.java file. Finally, package documentation (if any) is stored in a "package-info.java" file.

TODO(spetrovic): Run Java formatters on the generated files.

Jump to

Keyboard shortcuts

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