Class: JavaMappingGenericEnum

Inherits:
JavaMapping show all
Includes:
Singleton
Defined in:
lib/ontomde-uml2-java/javaMapping.rb

Constant Summary collapse

NULL_ENUM_VALUE_AS_STRING =
"nil"

Instance Attribute Summary

Attributes inherited from JavaMapping

#maxStringLength

Instance Method Summary collapse

Methods inherited from JavaMapping

#getGroovyCast, #getMappings, #getTemplate, #getValidationRegexp, #initialize

Constructor Details

This class inherits a constructor from JavaMapping

Instance Method Details

#appliesTo?(datatype) ⇒ Boolean

Returns:

  • (Boolean)


311
312
313
314
# File 'lib/ontomde-uml2-java/javaMapping.rb', line 311

def appliesTo?(datatype)
  return true if datatype.kind_of?(Muml_Enumeration)
  return false
end

#getFormCopyTo(field) ⇒ Object



318
319
320
321
# File 'lib/ontomde-uml2-java/javaMapping.rb', line 318

def getFormCopyTo(field)
  a=field
  return %{_to.set#{a.java_NameBean}(this.get#{a.java_NameBean}().compareTo("#{NULL_ENUM_VALUE_AS_STRING}")!=0 ? Enum.valueOf(#{a.uml_type_one.java_qualifiedName}.class,this.get#{a.java_NameBean}()):null);\n}
end

#getFormInitFrom(field) ⇒ Object



322
323
324
325
# File 'lib/ontomde-uml2-java/javaMapping.rb', line 322

def getFormInitFrom(field)
  #return "this.set#{field.java_NameBean}(_from.get#{field.java_NameBean}()==null ? -1 :_from.get#{field.java_NameBean}().ordinal());\n"
  return %{this.set#{field.java_NameBean}(_from.get#{field.java_NameBean}()==null ? "#{NULL_ENUM_VALUE_AS_STRING}" :_from.get#{field.java_NameBean}().name());\n}
end

#getJavaTypeObject



327
328
329
# File 'lib/ontomde-uml2-java/javaMapping.rb', line 327

def getJavaType
  return "java.lang.Object"
end