Package java implements Java code generation from compiled VDL packages.



    This section is empty.


    This section is empty.


    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.


      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 file. Finally, package documentation (if any) is stored in a "" file.

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