Value of TaggedValue in CodeGeneration

code-engineering

#1

Hi,

I added a TaggedValue “MaxLength” with a Value “255” to an attribute from my UML-Class. Now I want to use this value in my code generation:

#if($attribute.hasTaggedValue("MaxLength"))
	$attribute.getTaggedValue("MaxLength").getValue()
#end

I hoped to get “255”, but only get:
com.vp.instantgenerator.templatecodemodel.TemplateText@0

How can I get the Value of this Tagged Value?


#2

You can get the value in String by getName()

#if($attribute.hasTaggedValue("MaxLength"))
   #if($attribute.getTaggedValue("MaxLength").getValue())
      $attribute.getTaggedValue("MaxLength").getValue().getName()
   #end
#end

For more API details, you can reference below page.