v.io: v.io/x/ref/lib/vdl/codegen/java Index | Files

package java

import "v.io/x/ref/lib/vdl/codegen/java"

Package java implements Java code generation from compiled VDL packages.


Package Files

const.go file_array.go file_client_factory.go file_client_impl.go file_client_interface.go file_constants.go file_enum.go file_error.go file_list.go file_map.go file_package_info.go file_primitive.go file_server_interface.go file_server_wrapper.go file_set.go file_struct.go file_union.go generate.go util.go util_args.go util_doc.go util_file.go util_interface.go util_method.go util_path.go util_template.go util_type.go util_val.go

func SetPkgPathXlator Uses

func SetPkgPathXlator(xlator func(path string) string)

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

type JavaFileInfo Uses

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

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

func Generate Uses

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.

Package java imports 14 packages (graph) and is imported by 1 packages. Updated 2021-01-28. Refresh now. Tools for package owners.