class IbRubyProxy::Server::Reflection::IbField
An {IbClass} field
Constants
- IB_FIELD_PREFIX
Attributes
ib_class[R]
java_field[R]
Public Class Methods
new(java_field, ib_class)
click to toggle source
# File lib/ib_ruby_proxy/server/reflection/ib_field.rb, line 10 def initialize(java_field, ib_class) @java_field = java_field @ib_class = ib_class end
Public Instance Methods
default_value()
click to toggle source
Default value for the field
@return [Object]
# File lib/ib_ruby_proxy/server/reflection/ib_field.rb, line 18 def default_value case java_field.type when Java::int.java_class, Java::float.java_class, Java::double.java_class 0 when Java::boolean.java_class false end end
default_value_as_string()
click to toggle source
{#default_value Default value} as a string
@return [String]
# File lib/ib_ruby_proxy/server/reflection/ib_field.rb, line 30 def default_value_as_string value = default_value if value.nil? 'nil' else value.to_s end end
name()
click to toggle source
Return the name of the accessor method used to access the field
@return [String]
# File lib/ib_ruby_proxy/server/reflection/ib_field.rb, line 42 def name @name ||= find_name end
Private Instance Methods
find_name()
click to toggle source
# File lib/ib_ruby_proxy/server/reflection/ib_field.rb, line 48 def find_name field_name_without_prefix = java_field.name.gsub(IB_FIELD_PREFIX, '') matched_method = ib_class.klass.java_class.declared_instance_methods.find do |method| method.name.downcase == field_name_without_prefix.downcase end raise "No method matching '#{field.name}'?" unless matched_method matched_method.name end