Module: JMX::MBeans
- Defined in:
- lib/jmx/mbeans.rb
Overview
Holder for beans created from retrieval (namespace protection [tm]). This also gives MBeans nicer names when inspected
Class Method Summary collapse
-
.parent_for(java_class_fqn) ⇒ Object
Create modules in this namespace for each package in the Java fully qualified name and return the deepest module along with the Java class name back to the caller.
Class Method Details
.parent_for(java_class_fqn) ⇒ Object
Create modules in this namespace for each package in the Java fully qualified name and return the deepest module along with the Java class name back to the caller.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/jmx/mbeans.rb', line 11 def self.parent_for(java_class_fqn) java_class_fqn.split(".").inject(MBeans) do |parent, segment| # const_defined? will crash later if we don't remove $ segment.gsub!('$', 'Dollar') if segment =~ /\$/ # Note: We are boned if java class name is lower cased return [parent, segment] if segment =~ /^[A-Z]/ segment.capitalize! unless parent.const_defined? segment, false parent.const_set segment, Module.new else parent.const_get segment, false end end end |