Module: Muml_Namespace

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

Overview

module Muml_ClassifierTemplateParameter def umlx_hierarchy return nil end def java_ignoreMe? return true end end

Constant Summary collapse

JAVA_IGNORE_NAMESPACE =

List of namespaces to be ignored by generator.

NOTE:

  • user may add its own item int the list.

  • list may contain package or class qualified names.

EXAMPLE:

  • “org.xyz” will ignore every item under org.xyz

  • “org.xyz.ClassZ” will ignore only ClassZ

["java.", "javax.", "xmda.bpm.api", "ontomde.bpm", "xmda.common","org.acegi"]

Instance Method Summary collapse

Instance Method Details

#java_FilePathObject

Returns the path where to generate file for this object.

NOTE:

  • Root directory is taken from context (cf: mtk_context)

Examples (with context equals to “build/”:

  • build/package1/package2

  • build/package1/package2/UneClasse.java



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

def java_FilePath
  return java_getContextJavaFilePath(context[:javaDir])+java_InternalFilePath
end

#java_getContextJavaFilePath(default = nil) ⇒ Object



303
304
305
306
307
308
309
310
311
312
313
# File 'lib/ontomde-uml2-java/java.rb', line 303

def java_getContextJavaFilePath(default=nil)
  n=java_qualifiedName.to_s
  jfp=context[:javaFilePathRegexp,nil]
  return default if jfp.nil?
  jfp.each { |mapping|
    if n =~ mapping[0]
      return context[:targetDir]+"/"+mapping[1]
    end
  }
  return default
end

#java_ignoreMe?(ignoreExternal = true) ⇒ Boolean

return true if java generator should totaly ignore this element.

NOTE:

  • returns true if this class name is in JAVA_IGNORE_ROOT_PACKAGE_NAME

Returns:

  • (Boolean)


1204
1205
1206
1207
1208
1209
1210
1211
1212
# File 'lib/ontomde-uml2-java/java.rb', line 1204

def java_ignoreMe?(ignoreExternal=true)
  #puts "ignore=#{self.class} #{self.uml_name}"
  qn=java_qualifiedName
  return true if umlx_external? && ignoreExternal
  JAVA_IGNORE_NAMESPACE.each { |ns|
    return true if qn.index(ns)==0
  }
  return false;
end

#java_InternalFilePathObject

Returns the internal path where to generate file for this object.

NOTE:

Examples *package1/package2 *package1/package2/UneClasse.java



333
334
335
336
337
338
339
340
# File 'lib/ontomde-uml2-java/java.rb', line 333

def java_InternalFilePath
  r=""
  umlx_sub_hierarchy.each { |n|
    r+=n.java_Name
    r+="/"
  }
  return r
end

#java_qualifiedNameObject

Returns this element java qualified name

Example:

package1.package2.AClassClasse
AClassInRootDefaultPackage
package1.package2


1124
1125
1126
1127
1128
1129
1130
1131
1132
# File 'lib/ontomde-uml2-java/java.rb', line 1124

def java_qualifiedName
  r=sep=""
  umlx_hierarchy.each { |n|
    r+=sep
    r+=n.java_Name
    sep="."
  }
  return r
end