All Downloads are FREE. Search and download functionalities are using the official Maven repository.

crud_java_server_app_complex.functions.ftl Maven / Gradle / Ivy

There is a newer version: 2.4.3
Show newest version
<#-- -------------------- -->
<#-- OASP SPECIFIC MACROS -->
<#-- -------------------- -->

<#--
	Generates all field declaration whereas Entity references will be converted to appropriate id references
-->
<#macro generateFieldDeclarations_withRespectTo_entityObjectToIdReferenceConversion>
<#list pojo.fields as field>
<#if field.type?contains("Entity")> <#-- add ID getter & setter for Entity references only for ID references -->
   	private ${field.type?replace("[^<>,]+Entity","Long","r")} ${resolveIdVariableName(field)};
<#else>
	private ${field.type} ${field.name};




<#--
	Generates all setter and getter for the fields whereas for Entity fields it will generate setter and getter for id references
-->
<#macro generateSetterAndGetter_withRespectTo_entityObjectToIdReferenceConversion implementsInterface=true>
<#list pojo.fields as field>
<#if field.type?contains("Entity")> <#-- add ID getter & setter for Entity references only for ID references -->

	<#assign idVar = OaspUtil.resolveIdVariableName(classObject,field)>
	<#if implementsInterface>
	@Override
	public ${OaspUtil.getSimpleEntityTypeAsLongReference(field)} ${OaspUtil.resolveIdGetter(classObject,field)} {
		return ${idVar};
	}

	<#if implementsInterface>
	@Override
	public void ${OaspUtil.resolveIdSetter(classObject,field)}(${OaspUtil.getSimpleEntityTypeAsLongReference(field)} ${idVar}) {
		this.${idVar} = ${idVar};
	}
<#else>
   	<#if implementsInterface>
	@Override
	public ${field.type} <#if field.type=='boolean'>is<#else>get${field.name?cap_first}() {
		return ${field.name};
	}

	<#if implementsInterface>
	@Override
	public void set${field.name?cap_first}(${field.type} ${field.name}) {
		this.${field.name} = ${field.name};
	}








© 2015 - 2024 Weber Informatics LLC | Privacy Policy