Module: JMX::JavaTypeAware
- Included in:
- Attribute, Operation, Parameter, RubyDynamicMBean
- Defined in:
- lib/jmx/dynamic_mbean.rb
Overview
Module that is used to bridge java to ruby and ruby to java types.
Constant Summary collapse
- SIMPLE_TYPES =
Current list of types we understand If it’s not in this list we are assuming that we are going to convert to a java.object
{ :int => ['java.lang.Integer', lambda {|param| param.to_i}], :list => ['java.util.List', lambda {|param| param.to_a}], :long => ['java.lang.Long', lambda {|param| param.to_i}], :float => ['java.lang.Float', lambda {|param| param.to_f}], :double => ['java.lang.Double', lambda {|param| param.to_f}], :map => ['java.util.Map', lambda {|param| param}], :set => ['java.util.Set', lambda {|param| param}], :string => ['java.lang.String', lambda {|param| param.to_s}], :void => ['java.lang.Void', lambda {|param| nil}] }
Class Method Summary collapse
- .to_java_type(type_name) ⇒ Object
-
.to_ruby(type_name) ⇒ Object
TODO: I’m not sure this is strictly needed, but funky things can happen if you are expecting your attributes (from the ruby side) to be ruby types and they are java types.
Class Method Details
.to_java_type(type_name) ⇒ Object
23 24 25 |
# File 'lib/jmx/dynamic_mbean.rb', line 23 def to_java_type(type_name) SIMPLE_TYPES[type_name][0] || type_name end |
.to_ruby(type_name) ⇒ Object
TODO: I’m not sure this is strictly needed, but funky things can happen if you are expecting your attributes (from the ruby side) to be ruby types and they are java types.
29 30 31 |
# File 'lib/jmx/dynamic_mbean.rb', line 29 def to_ruby(type_name) SIMPLE_TYPES[type_name][1] || lambda {|param| param} end |