Class: JavaMapping
- Inherits:
-
Object
- Object
- JavaMapping
- Includes:
- Singleton
- Defined in:
- lib/ontomde-uml2-java/groovy.rb,
lib/ontomde-uml2-java/javaMapping.rb
Direct Known Subclasses
JavaMappingBLOB, JavaMappingBoolean, JavaMappingCalendar, JavaMappingFile, JavaMappingGenericClass, JavaMappingGenericEnum, JavaMappingText, JavaMappingTimeStamp
Constant Summary collapse
- @@types =
Array.new
Instance Attribute Summary collapse
-
#maxStringLength ⇒ Object
max length of this element represented as a string.
Instance Method Summary collapse
-
#appliesTo?(datatype) ⇒ Boolean
returns true if this templates applies to datatype.
-
#getGroovyCast(param) ⇒ Object
return a cast suitable for using with groovy binding.setVariable.
- #getJavaType ⇒ Object
- #getMappings ⇒ Object
- #getTemplate(datatype) ⇒ Object
- #getValidationRegexp ⇒ Object
-
#initialize ⇒ JavaMapping
constructor
A new instance of JavaMapping.
Constructor Details
#initialize ⇒ JavaMapping
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
#maxStringLength ⇒ Object
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
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 |
#getJavaType ⇒ Object
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 |
#getMappings ⇒ Object
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 |
#getValidationRegexp ⇒ Object
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 |