Class: Ea::Sources::Xmi::OperationBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/ea/sources/xmi/operation_builder.rb

Overview

Translates XMI OwnedOperation elements (with their OwnedParameter children) into Ea::Model::Operation instances.

Instance Method Summary collapse

Instance Method Details

#build_all_for(classifier) ⇒ Object



9
10
11
# File 'lib/ea/sources/xmi/operation_builder.rb', line 9

def build_all_for(classifier)
  classifier.owned_operation.map { |op| build_one(op, classifier) }
end

#build_one(op, owner) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ea/sources/xmi/operation_builder.rb', line 13

def build_one(op, owner)
  id = IdNormalizer.from_xmi_id(op.id) ||
       IdNormalizer.synthetic_id(owner.id, "op", op.name)
  Ea::Model::Operation.new(
    id: id,
    name: op.name,
    owner_id: owner.id,
    qualified_name: "#{owner.name}::#{op.name}",
    return_type_name: return_type_name_for(op),
    visibility: op.visibility,
    is_static: boolean(op.is_static),
    is_abstract: boolean(op.is_abstract),
    parameters: build_parameters(op, id),
    annotations: AnnotationBuilder.from_element(op, id)
  )
end