|
From: Vance K. <va...@us...> - 2006-04-24 02:22:33
|
User: vancek
Date: 06/04/23 19:22:31
Added: andromda-ejb3/src/main/resources/templates/ejb3
EmbeddedValue.vsl EmbeddedValueImpl.vsl
Log:
initial revision - added embedded object
Revision Changes Path
1.1 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EmbeddedValue.vsl
Index: EmbeddedValue.vsl
===================================================================
#set ($generatedFile = "${embeddedValue.packagePath}/${embeddedValue.name}.java")
// license-header java merge-point
//
// Attention: Generated code! Do not modify by hand!
// Generated by: EmbeddedValue.vsl in andromda-ejb3-cartridge.
//
#if ($stringUtils.isNotBlank($embeddedValue.packageName))
package $embeddedValue.packageName;
#end
/**
$embeddedValue.getDocumentation(" * ")
*/
@javax.persistence.Embeddable
public abstract class $embeddedValue.name
#if($embeddedValue.generalization)
extends $embeddedValue.generalization.fullyQualifiedName
#end
implements java.io.Serializable
{
/**
* The serial version UID of this class. Needed for serialization.
*/
private static final long serialVersionUID = ${embeddedValue.serialVersionUID}L;
#if (!$embeddedValue.abstract)
/**
* Creates a new instance of {@link ${embeddedValue.name}}
* taking all properties.
*/
#set ($parenthesis = "(")
#if ($embeddedValue.attributes.empty)
#set ($parenthesis = "()")
#end
public static $embeddedValue.name newInstance${parenthesis}#foreach ($attribute in $embeddedValue.attributes)
$attribute.getterSetterTypeName ${attribute.name}#if($velocityCount != $embeddedValue.attributes.size()),#else)
#end
#end
{
$embeddedValue.implementationName object = new ${embeddedValue.implementationName}();
#foreach ($attribute in $embeddedValue.attributes)
object.${attribute.setterName}($attribute.name);
#end
object.initialize();
return object;
}
/**
* Creates a new instance from other $embeddedValue.name instance.
*/
public static ${embeddedValue.name} newInstance($embeddedValue.name otherObject)
{
if (otherObject != null)
{
return newInstance(#foreach ($attribute in $embeddedValue.attributes)
otherObject.${attribute.getterName}()#if($velocityCount != $embeddedValue.attributes.size()),#end#end);
}
return null;
}
protected ${embeddedValue.name}()
{
}
/**
* Hook for initializing the object in the subclass
*/
protected void initialize()
{
}
#foreach ($attribute in $embeddedValue.attributes)
private $attribute.getterSetterTypeName $attribute.name;
/**
$attribute.getDocumentation(" * ")
*/
$attribute.visibility $attribute.getterSetterTypeName ${attribute.getterName}()
{
return this.${attribute.name};
}
#if ($embeddedValue.immutable)
// protected setter, if subclass methods need to normalize the $embeddedValue.name
protected void ${attribute.setterName}($attribute.getterSetterTypeName $attribute.name)
#else
$attribute.visibility void ${attribute.setterName}($attribute.getterSetterTypeName $attribute.name)
#end
{
this.${attribute.name} = $attribute.name;
}
#end
#foreach ($operation in $embeddedValue.operations)
#set ($returnType = $operation.returnType)
#set ($signature = $operation.signature)
/**
$operation.getDocumentation(" * ")
*/
#if ($operation.exceptionsPresent)
$operation.visibility abstract $returnType.fullyQualifiedName $signature
throws $operation.exceptionList;
#else
$operation.visibility abstract $returnType.fullyQualifiedName $signature;
#end
#end
#end
/**
* Indicates if the argument is of the same type and all values are equal.
*/
#renderEqualsMethod($class $embeddedValue.name $embeddedValue.attributes)
#set ($attributeCollection = $embeddedValue.attributes)
#renderHashCodeMethod($class $attributeCollection)
}
1.1 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EmbeddedValueImpl.vsl
Index: EmbeddedValueImpl.vsl
===================================================================
#set ($generatedFile = "${embeddedValue.packagePath}/${embeddedValue.implementationName}.java")
// license-header java merge-point
/**
* This is only generated once! It will never be overwritten.
* You can (and have to!) safely modify it by hand.
*/
#if ($stringUtils.isNotBlank($embeddedValue.packageName))
package $embeddedValue.packageName;
#end
/**
* @see $embeddedValue.fullyQualifiedName
*/
public#if ($embeddedValue.abstract) abstract#end class $embeddedValue.implementationName
extends $embeddedValue.fullyQualifiedName
implements java.io.Serializable
{
/**
* The serial version UID of this class. Needed for serialization.
*/
private static final long serialVersionUID = ${embeddedValue.serialVersionUID}L;
#foreach ($operation in $embeddedValue.operations)
/**
* @see ${embeddedValue.fullyQualifiedName}#${operation.getSignature(false)}
*/
$operation.visibility $operation.returnType.fullyQualifiedName $operation.signature
#if ($operation.exceptionsPresent)
throws $operation.exceptionList
#end
{
// ${toDoTag} implement $operation.visibility $operation.returnType.fullyQualifiedName $operation.signature
#if ($operation.returnTypePresent)
return $operation.returnType.javaNullString;
#else
throw new java.lang.UnsupportedOperationException("${embeddedValue.fullyQualifiedName}.${operation.signature} Not implemented!");
#end
}
#end
}
|