Top Level Namespace

Defined Under Namespace

Modules: Mjava_Annotation, Mrdf_Model, Mrdf_Resource, Muml_Class, Muml_Classifier, Muml_DataType, Muml_Element, Muml_Enumeration, Muml_EnumerationLiteral, Muml_Interface, Muml_Model, Muml_MultiplicityElement, Muml_NamedElement, Muml_Namespace, Muml_Operation, Muml_Parameter, Muml_Property, Muml_Stereotype, Muml_Stereotype_Create, Muml_TypedElement, Muml_UML, Muml_VisibilityKind, Ontomde Classes: Crdfs_Class, JHelper, JavaMapping, JavaMappingBLOB, JavaMappingBoolean, JavaMappingCalendar, JavaMappingEmailAddress, JavaMappingFile, JavaMappingGRAPHVIZ, JavaMappingGenericClass, JavaMappingGenericEnum, JavaMappingIMG, JavaMappingInteger, JavaMappingLargeText, JavaMappingLong, JavaMappingLongObject, JavaMappingMimeType, JavaMappingOrdinal, JavaMappingPassword, JavaMappingText, JavaMappingTimeStamp, JavaMappingURL, Java_collectionMapping_Array, Java_collectionMapping_Collection_ArrayList, Java_collectionMapping_List_ArrayList, Java_collectionMapping_None, Java_collectionMapping_Set_HashSet, Java_collectionMapping_base, String

Instance Method Summary collapse

Instance Method Details

#addDataTypeMapping(umlDataTypeName, baseMapping, regexp = nil, &block) ⇒ Object

wrapper to easylly create a new datatype mapping

  • umlDataTypeName is the name of the data type in source uml model

  • baseMapping is the base definition mapping to derive from

  • regexp is the string regexp used for display



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ontomde-uml2-java/javaMapping.rb', line 7

def addDataTypeMapping(umlDataTypeName,baseMapping,regexp=nil,&block)
  if !baseMapping.kind_of?(Class)
    raise Exception.new(%{Bad parameter type used for baseMapping got "#{baseMapping.class}" and expected "Class"})
  end

  rubyName=umlDataTypeName.tr('^a-zA-Z0-9','_')
  s=%{
	class JavaMapping#{rubyName} < #{baseMapping.name}
		include Singleton
		def appliesTo?(datatype)
			return datatype.uml_name.to_s=="#{umlDataTypeName}"
		end
		#{regexp.nil? ? ""  : %{
  def getValidationRegexp
  return /#{regexp.source}/
  end
  }
		}
	end
	JavaMapping#{rubyName}.class_eval( &block ) unless block.nil?

	JavaMapping#{rubyName}.instance #register
  }
  t=eval s


end