Class: JavaMapping

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/ontomde-uml2-java/groovy.rb,
lib/ontomde-uml2-java/javaMapping.rb

Constant Summary collapse

@@types =
Array.new

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeJavaMapping

Returns a new instance of JavaMapping.



41
42
43
44
45
# File 'lib/ontomde-uml2-java/javaMapping.rb', line 41

def initialize
  return if self.class==JavaMapping
  @@types << self
  #log.debug { %{registered(##{@@types.size}): #{self.class}} }
end

Instance Attribute Details

#maxStringLengthObject

max length of this element represented as a string



73
74
75
# File 'lib/ontomde-uml2-java/javaMapping.rb', line 73

def maxStringLength
  @maxStringLength
end

Instance Method Details

#appliesTo?(datatype) ⇒ Boolean

returns true if this templates applies to datatype

Returns:

  • (Boolean)


47
48
49
50
51
# File 'lib/ontomde-uml2-java/javaMapping.rb', line 47

def appliesTo?(datatype)
  # inheriting class should redefine this method
  log.error %{appliesTo? not implemented for #{self.class}}
  return false
end

#getGroovyCast(param) ⇒ Object

return a cast suitable for using with groovy binding.setVariable



53
54
55
# File 'lib/ontomde-uml2-java/groovy.rb', line 53

def getGroovyCast(param)
  return nil
end

#getJavaTypeObject



66
67
68
69
70
# File 'lib/ontomde-uml2-java/javaMapping.rb', line 66

def getJavaType
  # inheriting class should redefine this method
  log.error %{getJavaType not implemented for #{self.class}}
  return %{/* TODO: implement ruby getJavaType for #{self.class}*/}
end

#getMappingsObject



37
38
39
# File 'lib/ontomde-uml2-java/javaMapping.rb', line 37

def getMappings
  return @@types
end

#getTemplate(datatype) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/ontomde-uml2-java/javaMapping.rb', line 52

def getTemplate(datatype)
  @@types.each {|t|
    next unless t.appliesTo?(datatype)
    return t
  }
  if !datatype.context[:silentlyForceUnknownDatatypeToString,false]
    msg= %{No template #{self.class} found for datatype "#{datatype}"}
    log.error msg unless log_already_displayed?(msg)
  end

  return JavaMappingText.instance
  #return JavaMappingerror.instance
end

#getValidationRegexpObject



77
78
79
80
# File 'lib/ontomde-uml2-java/javaMapping.rb', line 77

def getValidationRegexp
  #log.error %{getValidationRegexp not implemented for #{self.class}}
  return nil #%{/* TODO: implement ruby getValidationRegexp for #{self.class}*/}
end