Module: Droiuby::ViewHelper::ClassMethods
- Defined in:
- lib/droiuby/wrappers/java_helpers/view_helper.rb
Instance Method Summary collapse
- #java_attr_accessor(*symbols) ⇒ Object
- #java_attr_boolean_reader(*symbols) ⇒ Object
- #java_attr_reader(*symbols) ⇒ Object
- #java_attr_writer(*symbols) ⇒ Object
- #java_fast_accessor(java_klass, params = [], *symbols) ⇒ Object
- #java_fast_reader(java_klass, *symbols) ⇒ Object
Instance Method Details
#java_attr_accessor(*symbols) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/droiuby/wrappers/java_helpers/view_helper.rb', line 69 def java_attr_accessor(*symbols) symbols.each do |s| java_setter_method = "set#{s.to_s.camelize}".to_sym java_getter_method = "get#{s.to_s.camelize}".to_sym define_method(s) do native.send(java_getter_method) end define_method("#{s}=".to_sym) do |value| native.send(java_setter_method,value) end end end |
#java_attr_boolean_reader(*symbols) ⇒ Object
60 61 62 63 64 65 66 67 |
# File 'lib/droiuby/wrappers/java_helpers/view_helper.rb', line 60 def java_attr_boolean_reader(*symbols) symbols.each do |s| java_getter_method = "is#{s.to_s.camelize}".to_sym define_method(s) do native.send(java_getter_method) end end end |
#java_attr_reader(*symbols) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/droiuby/wrappers/java_helpers/view_helper.rb', line 42 def java_attr_reader(*symbols) symbols.each do |s| java_getter_method = "get#{s.to_s.camelize}".to_sym define_method(s) do native.send(java_getter_method) end end end |
#java_attr_writer(*symbols) ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/droiuby/wrappers/java_helpers/view_helper.rb', line 51 def java_attr_writer(*symbols) symbols.each do |s| java_setter_method = "set#{s.to_s.camelize}".to_sym define_method("#{s}=".to_sym) do |value| native.send(java_setter_method, value) end end end |
#java_fast_accessor(java_klass, params = [], *symbols) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/droiuby/wrappers/java_helpers/view_helper.rb', line 23 def java_fast_accessor(java_klass, params = [], *symbols) symbols.each do |s| java_getter_method = "get#{s.to_s.camelize}".to_sym java_setter_method = "set#{s.to_s.camelize}".to_sym unbound_getter_method = java_klass.java_method(java_getter_method, []) unbound_setter_method = java_klass.java_method(java_setter_method, params) define_method(s) do unbound_getter_method.bind(self.native).call end define_method("#{s}=".to_sym) do |arg| unbound_setter_method.bind(self.native).call(arg) end end end |
#java_fast_reader(java_klass, *symbols) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/droiuby/wrappers/java_helpers/view_helper.rb', line 11 def java_fast_reader(java_klass, *symbols) symbols.each do |s| java_getter_method = "get#{s.to_s.camelize}".to_sym unbound_getter_method = java_klass.java_method(java_getter_method, []) define_method(s) do unbound_getter_method.bind(self.native).call end end end |