def create_json_conversion(data, type, is_map=True): if is_list(type): type = strip_list(type) if type in json_conversion: return "{}({}.toString())".format(json_conversion[type], data) elif type == "string": return "{}.toString()".format(data) elif is_map: return "new {}((Map<String, Object>){})".format(camel_case_caps(type), data) else: return "new {}((List<Object>){})".format(camel_case_caps(type), data)
def create_json_conversion(data, type, is_map=True): if is_list(type): type = strip_list(type) if type in json_conversion: return "{}({}.toString())".format(json_conversion[type], data) elif type == "string": return "{}.toString()".format(data) elif is_map: return "new {}((Map<String, Object>){})".format( camel_case_caps(type), data) else: return "new {}((List<Object>){})".format(camel_case_caps(type), data)
def build_main(model): name = model['metadata']['name'] root = 'java/src/realtimeweb/' + flat_case(name) + '/' return { root + camel_case_caps(name) + '.java': env.get_template('main.java', globals=model).render() }
def build_main(model): name = model['metadata']['name'] root = 'java/{name}/src/corgis/{name}/'.format(name=snake_case(name)) return { root + camel_case_caps(name) + 'Library.java': env.get_template('main.java').render(**model) }
def convert_to_racket_type(source_type): was_list = is_list(source_type) if was_list: source_type = strip_list(source_type) #chomp out the "list(" and ")" target_type = java_type_names.get(source_type, camel_case_caps(source_type)) if was_list: # if it's a list, apply it to each element return "ArrayList<{}>".format(target_type) else: # otherwise just return it normally return target_type
def build_classes(model): name = model['metadata']['name'] root = 'java/src/realtimeweb/' + flat_case(name) + '/domain/' files = {} template = env.get_template('domain.java', globals={'object_is_map' : model["object_is_map"], 'metadata': model['metadata']}) for object in model['objects']: filename = root + camel_case_caps(object['name']) + '.java' files[filename] = template.render(object=object) return files
def convert_to_python_type(source): was_list = is_list(source) if was_list: source = strip_list(source) #chomp out the "list(" and ")" converted_type= python_types.get(source, None) if converted_type is None: # need to convert to custom class converted_type = camel_case_caps(source) if was_list: # if it's a list, apply it to each element return "list of {}".format(converted_type) else: # otherwise just return it normally return converted_type
def convert_to_racket_type(source): was_list = is_list(source) if was_list: source = strip_list(source) #chomp out the "list(" and ")" converted_type= racket_types.get(source, None) if converted_type is None: # need to convert to custom class converted_type = camel_case_caps(source) if was_list: # if it's a list, apply it to each element return "list of {}".format(converted_type) else: # otherwise just return it normally return converted_type
def build_classes(model): name = model['metadata']['name'] root = 'java/{name}/src/corgis/{name}/domain/'.format( name=snake_case(name)) files = {} template = env.get_template('domain.java') for structure_name, structure in model['structures'].items(): for path, data in structure['dictionaries'].items(): filename = root + camel_case_caps( clean_invalid_characters(data['name'])) + '.java' files[filename] = template.render(dictionary=data, **model) return files
def build_classes(model): name = model['metadata']['name'] root = 'java/src/realtimeweb/' + flat_case(name) + '/domain/' files = {} template = env.get_template('domain.java', globals={ 'object_is_map': model["object_is_map"], 'metadata': model['metadata'] }) for object in model['objects']: filename = root + camel_case_caps(object['name']) + '.java' files[filename] = template.render(object=object) return files
def convert_to_java_type(source_type, source_name=None, something=None): if source_name is None: source_name = source_type was_list = is_list(source_type) if was_list: source_type = strip_list(source_type) #chomp out the "list(" and ")" if is_list(source_name): source_name = strip_list(source_name) #print(source_type, source_name) source_name = clean_invalid_characters(source_name) target_type = java_type_names.get(source_type, camel_case_caps(source_name)) if was_list: # if it's a list, apply it to each element return "ArrayList<{}>".format(target_type) else: # otherwise just return it normally return target_type
def build_main(model): name = model['metadata']['name'] root = 'java/src/realtimeweb/' + flat_case(name) + '/' return {root + camel_case_caps(name) + '.java' : env.get_template('main.java', globals=model).render()}