![JAR search and dependency download from the Maven repository](/logo.png)
templates.java.ServiceImpl.vsl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of andromda-java-cartridge Show documentation
Show all versions of andromda-java-cartridge Show documentation
Produces generic Java code, such as: value objects, enumerations, exceptions, interfaces, etc.
The newest version!
#if ($umlUtils.shouldOutput($service))
// license-header java merge-point
/**
* Generated by java cartridge ServiceImpl.vsl
* This is only generated once! It will never be overwritten.
* You can (and have to!) safely modify it by hand.
*/
#if ($stringUtils.isNotBlank($service.packageName))
package $service.packageName;
#end
/**
* @see $service.fullyQualifiedName
*/
public class ${service.name}Impl
#if(!$service.generalizations.empty)
#set ($superclass = $service.generalization)
extends $superclass.fullyQualifiedName
#end
implements $service.fullyQualifiedName
{
#if ($serializable)
/**
* The serial version UID of this class. Needed for serialization.
*/
private static final long serialVersionUID = ${service.serialVersionUID}L;
#end
#foreach ($operation in $service.implementationOperations)
#set ($returnType = $operation.returnType)
#set ($returnObject = "returnValue")
/**
* @see ${service.fullyQualifiedName}${esc.hash}${operation.getSignature(false)}
*/
$operation.visibility $operation.getterSetterReturnTypeName $operation.signature
#if ($operation.exceptionsPresent)
throws $operation.exceptionList
#end
{
// ${toDoTag} implement $operation.visibility $operation.getterSetterReturnTypeName $operation.signature
#if ($operation.returnTypePresent)
#if (!$operation.returnType.primitive)
return null;
#elseif ("boolean" == $operation.getterSetterReturnTypeName)
return false;
#else
return ($operation.getterSetterReturnTypeName)0;
#end
#else
throw new UnsupportedOperationException("${service.fullyQualifiedName}.${operation.signature} Not implemented!");
#end
}
#end
#foreach ($abstraction in $service.abstractions)
#set ($target = $abstraction.targetElement)
#foreach ($attribute in $target.allProperties)
#set ($returnType = $attribute.getterSetterTypeName)
/** #if ($attribute.defaultValuePresent)${attribute.defaultValue}#end */
protected $returnType $attribute.name#if ($attribute.defaultValuePresent) = ${attribute.defaultValue}#end;
/**
$attribute.getDocumentation(" * ")
* Get the $attribute.name Attribute
* @return $attribute.name $returnType
## * $attribute $attribute.type $attribute.type.booleanType $generateIsBooleanGetters $attribute.upper $attribute.many
*/
public $returnType ${attribute.getterName}()
{
#if ($attribute.many && !$attribute.type.arrayType)
if (this.${attribute.name} == null)
{
## Todo: make it better
this.${attribute.name} = new java.util.ArrayList#if($enableTemplating)<#if(${attribute.type.primitive})${attribute.type.wrapperName}#else${attribute.type.fullyQualifiedName}#end>#end();
}
#end
return this.$attribute.name;
}
#if (!$attribute.readOnly)
/**
$attribute.getDocumentation(" * ")
* @param ${attribute.name}In $returnType
#if($generateChainedSetters)
* @return this ${service.name}Impl
#end
*/
public#if($generateChainedSetters) ${target.name}#else void#end ${attribute.setterName}($returnType ${attribute.name}In)
{
this.${attribute.name} = ${attribute.name}In;
#if($generateChainedSetters)
return this;
#end
}
#end
#end
#end
}
#end
© 2015 - 2025 Weber Informatics LLC | Privacy Policy