Module: JavaFields
- Defined in:
- lib/jeventmachine.rb
Instance Method Summary collapse
Instance Method Details
#get_field(key) ⇒ Object
49 50 51 52 53 |
# File 'lib/jeventmachine.rb', line 49 def get_field(key) field = getClass.getDeclaredField(key) field.setAccessible(true) field.get(self) end |
#set_field(key, value) ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/jeventmachine.rb', line 39 def set_field(key, value) field = getClass.getDeclaredField(key) field.setAccessible(true) if field.getType.toString == 'int' field.setInt(self, value) else field.set(self, value) end end |