Class: IbRubyProxy::Server::Reflection::IbField

Inherits:
Object
  • Object
show all
Defined in:
lib/ib_ruby_proxy/server/reflection/ib_field.rb

Overview

An IbClass field

Constant Summary collapse

IB_FIELD_PREFIX =
/^m_/.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(java_field, ib_class) ⇒ IbField

Returns a new instance of IbField.



10
11
12
13
# 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

Instance Attribute Details

#ib_classObject (readonly)

Returns the value of attribute ib_class.



8
9
10
# File 'lib/ib_ruby_proxy/server/reflection/ib_field.rb', line 8

def ib_class
  @ib_class
end

#java_fieldObject (readonly)

Returns the value of attribute java_field.



8
9
10
# File 'lib/ib_ruby_proxy/server/reflection/ib_field.rb', line 8

def java_field
  @java_field
end

Instance Method Details

#default_valueObject

Default value for the field

Returns:

  • (Object)


18
19
20
21
22
23
24
25
# 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_stringString

Default value as a string

Returns:

  • (String)


30
31
32
33
34
35
36
37
# 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

#nameString

Return the name of the accessor method used to access the field

Returns:

  • (String)


42
43
44
# File 'lib/ib_ruby_proxy/server/reflection/ib_field.rb', line 42

def name
  @name ||= find_name
end