schema_salad.java_codegen

Java code generator for a given schema salad definition.

Attributes

USE_ONE_OR_LIST_OF_TYPES

BASIC_JAVA_IDENTIFIER_RE

prims

Classes

JavaCodeGen

Abstract base class for schema salad code generators.

Module Contents

schema_salad.java_codegen.USE_ONE_OR_LIST_OF_TYPES: Final = False
schema_salad.java_codegen.BASIC_JAVA_IDENTIFIER_RE: Final
schema_salad.java_codegen.prims: Final
class schema_salad.java_codegen.JavaCodeGen(base, target, examples, package, copyright)

Bases: schema_salad.codegen_base.CodeGenBase

Inheritance diagram of schema_salad.java_codegen.JavaCodeGen

Abstract base class for schema salad code generators.

Parameters:
  • base (str)

  • target (str | None)

  • examples (str | None)

  • package (str)

  • copyright (str | None)

base_uri: Final
examples: Final
package: Final
artifact: Final
copyright: Final
target_dir: Final
rel_package_dir: Final
main_src_dir: Final
test_src_dir: Final
test_resources_dir: Final
prologue()

Trigger to generate the prolouge code.

Return type:

None

static property_name(name)
Parameters:

name (str)

Return type:

str

static safe_name(name)

Generate a safe version of the given name.

Parameters:

name (str)

Return type:

str

interface_name(n)
Parameters:

n (str)

Return type:

str

begin_class(classname, extends, doc, abstract, field_names, idfield, optional_fields)

Produce the header for the given class.

Parameters:
Return type:

None

end_class(classname, field_names)

Finish this class.

Parameters:
Return type:

None

type_loader(type_declaration, container=None, no_link_check=None)

Parse the given type declaration and declare its components.

Parameters:
Return type:

schema_salad.codegen_base.TypeDef

type_loader_enum(type_declaration)

Build an enum type loader for the given declaration.

Parameters:

type_declaration (dict[str, Any])

Return type:

schema_salad.codegen_base.TypeDef

declare_field(name, fieldtype, doc, optional, subscope)

Output the code to load the given field.

Parameters:
Return type:

None

declare_id_field(name, fieldtype, doc, optional)

Output the code to handle the given ID field.

Parameters:
Return type:

None

uri_loader(inner, scoped_id, vocab_term, ref_scope, no_link_check=None)

Construct the TypeDef for the given URI loader.

Parameters:
Return type:

schema_salad.codegen_base.TypeDef

idmap_loader(field, inner, map_subject, map_predicate)

Construct the TypeDef for the given mapped ID loader.

Parameters:
Return type:

schema_salad.codegen_base.TypeDef

typedsl_loader(inner, ref_scope)

Construct the TypeDef for the given DSL loader.

Parameters:
Return type:

schema_salad.codegen_base.TypeDef

to_java(val)
Parameters:

val (Any)

Return type:

Any

epilogue(root_loader)

Trigger to generate the epilouge code.

Parameters:

root_loader (schema_salad.codegen_base.TypeDef)

Return type:

None

secondaryfilesdsl_loader(inner)

Construct the TypeDef for secondary files.

Parameters:

inner (schema_salad.codegen_base.TypeDef)

Return type:

schema_salad.codegen_base.TypeDef