Class: UML13ToECore

Inherits:
RGen::Transformer show all
Includes:
RGen::ECore
Defined in:
lib/transformers/uml13_to_ecore.rb

Constant Summary

Constants included from RGen::ECore

RGen::ECore::EBoolean, RGen::ECore::EFloat, RGen::ECore::EInt, RGen::ECore::EJavaClass, RGen::ECore::EJavaObject, RGen::ECore::ELong, RGen::ECore::ERubyClass, RGen::ECore::ERubyObject, RGen::ECore::EString

Instance Method Summary collapse

Methods included from RGen::MetamodelBuilder::ModuleExtension

#_annotations, #_constantOrder, #annotation, extended, #final_method, #method_added

Methods included from RGen::ECore::ECoreInterface

#_set_ecore_internal, clear_ecore_cache, #ecore

Methods inherited from RGen::Transformer

_methods, #_transformProperties, _transformer_blocks, copy, copy_all, #copy_features, method, #method_missing, #trans, transform

Constructor Details

#initialize(*args) ⇒ UML13ToECore

Options:

:reference_filter:

a proc which receives an AssociationEnd or a Dependency and should return
true or false, depending on if a referece should be created for it or not


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/transformers/uml13_to_ecore.rb', line 15

def initialize(*args)
  options = {}
  if args.last.is_a?(Hash)
    options = args.pop
  end
  @reference_filter = options[:reference_filter] || proc do |e|
    if e.is_a?(UML13::AssociationEnd)
      otherEnd = e.association.connection.find{|ae| ae != e}
      otherEnd.name && otherEnd.name.size > 0
    else
      false
    end
  end
  super(*args)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RGen::Transformer

Instance Method Details

#createAnnotations(taggedValues) ⇒ Object



116
117
118
119
120
121
122
# File 'lib/transformers/uml13_to_ecore.rb', line 116

def createAnnotations(taggedValues)
  if taggedValues.size > 0
    [ EAnnotation.new(:details => trans(taggedValues)) ]
  else
    []
  end
end

#transformObject



31
32
33
# File 'lib/transformers/uml13_to_ecore.rb', line 31

def transform
  trans(:class => UML13::Class)
end