schema_salad.java_codegen
Java code generator for a given schema salad definition.
Attributes
Classes
Abstract base class for schema salad code generators. |
Functions
|
Module Contents
- schema_salad.java_codegen.USE_ONE_OR_LIST_OF_TYPES = False
- schema_salad.java_codegen.BASIC_JAVA_IDENTIFIER_RE
- schema_salad.java_codegen.doc_to_doc_string(doc, indent_level=0)
- Parameters:
doc (Optional[str])
indent_level (int)
- Return type:
str
- schema_salad.java_codegen.prims
- class schema_salad.java_codegen.JavaCodeGen(base, target, examples, package, copyright)
Bases:
digraph inheritance75c0201e38 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "CodeGenBase" [URL="../codegen_base/index.html#schema_salad.codegen_base.CodeGenBase",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract base class for schema salad code generators."]; "JavaCodeGen" [URL="#schema_salad.java_codegen.JavaCodeGen",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "CodeGenBase" -> "JavaCodeGen" [arrowsize=0.5,style="setlinewidth(0.5)"]; }schema_salad.codegen_base.CodeGenBase
Abstract base class for schema salad code generators.
- Parameters:
base (str)
target (Optional[str])
examples (Optional[str])
package (str)
copyright (Optional[str])
- base_uri
- examples
- package
- artifact
- copyright
- target_dir
- rel_package_dir
- main_src_dir
- test_src_dir
- test_resources_dir
- 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:
classname (str)
extends (collections.abc.MutableSequence[str])
doc (str)
abstract (bool)
field_names (collections.abc.MutableSequence[str])
idfield (str)
optional_fields (set[str])
- Return type:
None
- end_class(classname, field_names)
Finish this class.
- Parameters:
classname (str)
field_names (list[str])
- Return type:
None
- type_loader(type_declaration, container=None, no_link_check=None)
Parse the given type declaration and declare its components.
- Parameters:
type_declaration (Union[list[Any], dict[str, Any], str])
container (Optional[str])
no_link_check (Optional[bool])
- Return type:
- type_loader_enum(type_declaration)
Build an enum type loader for the given declaration.
- Parameters:
type_declaration (dict[str, Any])
- Return type:
- declare_field(name, fieldtype, doc, optional, subscope)
Output the code to load the given field.
- Parameters:
name (str)
fieldtype (schema_salad.codegen_base.TypeDef)
doc (Optional[str])
optional (bool)
subscope (Optional[str])
- Return type:
None
- declare_id_field(name, fieldtype, doc, optional)
Output the code to handle the given ID field.
- Parameters:
name (str)
fieldtype (schema_salad.codegen_base.TypeDef)
doc (Optional[str])
optional (bool)
- 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:
scoped_id (bool)
vocab_term (bool)
ref_scope (Optional[int])
no_link_check (Optional[bool])
- Return type:
- idmap_loader(field, inner, map_subject, map_predicate)
Construct the TypeDef for the given mapped ID loader.
- Parameters:
field (str)
map_subject (str)
map_predicate (Optional[str])
- Return type:
- typedsl_loader(inner, ref_scope)
Construct the TypeDef for the given DSL loader.
- Parameters:
ref_scope (Union[int, None])
- Return type:
- 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:
- Return type: