Module: Muml_Enumeration

Defined in:
lib/ontomde-uml2-java/java.rb

Overview

end

Instance Method Summary collapse

Instance Method Details

#java_writeClassBodyObject

write enum body (list of litterals) using java_writeClassComment, java_writeClassModifiers, java_writeMetaClassName.

Example:

  • { red,blue,green }



395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# File 'lib/ontomde-uml2-java/java.rb', line 395

def java_writeClassBody
  java_writeClassComment
  java_writeJavadoc
  java_writeAnnotation
  java_writeClassModifiers
  java_writeMetaClassName
  java_writeImplements
  write("{\n")
  sep=""
  uml_ownedLiteral.each {|c|
    write(sep);
    c.java_writeJavadoc
    write(c.java_Name)
    if !c.java_initParameterValue.empty?
      sep=("(")
      c.java_initParameterValue.each {|v|
        write(sep) ; sep=","
        write(v)
      }
      write(")")
    end
    sep=",\n"
  }
  write(";\n") # literal/code separator

  #java_writeDeclarationSpecificOnBegin
  java_writeAttributes
  write("\n\n")
  #java_writeConstructors
  write("\n\n")
  java_writeOperations
  java_writeCustomCode
  #java_writeDeclarationSpecificOnEnd



  write("\n}");
end

#java_writeImplementsObject

write java implements declaration clause if needed.

Example:

  • implements interface1, interface2



438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
# File 'lib/ontomde-uml2-java/java.rb', line 438

def java_writeImplements
  imp=Set.new
  uml_implementation.each { |g|
    imp.add(g.uml_supplier_one.java_qualifiedName)
  }
  java_implements.each { |g|
    imp.add(g)
  }

  sep="\nimplements "
  imp.sort{ |a,b| a <=> b}.each { |g|
    write(sep)
    write(g)
    sep=","
  }
end

#java_writeMetaClassNameObject

writes java5 enum keyword and enum class name

Example:

  • enum Colors



387
388
389
# File 'lib/ontomde-uml2-java/java.rb', line 387

def java_writeMetaClassName
  write("enum #{java_Name}")
end