Class: MiniProperty

Inherits:
Object
  • Object
show all
Defined in:
lib/sawa/MiniProperty.rb

Instance Method Summary collapse

Constructor Details

#initialize(row, sheet) ⇒ MiniProperty

Returns a new instance of MiniProperty.



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/sawa/MiniProperty.rb', line 2

def initialize(row, sheet)
  @row = row
  @sheet = sheet
  @idx_type = 1
  @idx_name = 2
  @idx_unique = 3
  @idx_nullable = 4
  @idx_jsonignore = 5
  @idx_title = 6
  @idx_mappedBy = 7
  @idx_refColumn = 8
  @idx_searchKey = 9
end

Instance Method Details

#has_mappedObject



65
66
67
# File 'lib/sawa/MiniProperty.rb', line 65

def has_mapped
  @row[@idx_mappedBy] == "1:1" or @row[@idx_mappedBy] == "1:n" or @row[@idx_mappedBy] == "n:1"
end

#is_columnObject



61
62
63
# File 'lib/sawa/MiniProperty.rb', line 61

def is_column
  @row[@idx_unique] != "-"
end

#is_manytooneObject



77
78
79
# File 'lib/sawa/MiniProperty.rb', line 77

def is_manytoone
  @row[@idx_mappedBy] == "n:1"
end

#is_onetomanyObject



73
74
75
# File 'lib/sawa/MiniProperty.rb', line 73

def is_onetomany
  @row[@idx_mappedBy] == "1:n"
end

#is_onetooneObject



81
82
83
# File 'lib/sawa/MiniProperty.rb', line 81

def is_onetoone
  @row[@idx_mappedBy] == "1:1"
end

#is_searchkeyObject



85
86
87
# File 'lib/sawa/MiniProperty.rb', line 85

def is_searchkey
  @row[@idx_searchKey] == "1"
end

#is_stringObject



28
29
30
# File 'lib/sawa/MiniProperty.rb', line 28

def is_string
  @row[@idx_type] == "java.lang.String"
end

#join_columnObject



69
70
71
# File 'lib/sawa/MiniProperty.rb', line 69

def join_column
  @row[@idx_refColumn]
end

#jsonignoreObject



53
54
55
# File 'lib/sawa/MiniProperty.rb', line 53

def jsonignore
  @row[@idx_jsonignore] == "1"
end

#nameObject



20
21
22
# File 'lib/sawa/MiniProperty.rb', line 20

def name
  @row[@idx_name]
end

#nullableObject



49
50
51
# File 'lib/sawa/MiniProperty.rb', line 49

def nullable
  @row[@idx_nullable] == "1"
end

#resource_nameObject



16
17
18
# File 'lib/sawa/MiniProperty.rb', line 16

def resource_name
  @sheet.resource_path
end

#titleObject



57
58
59
# File 'lib/sawa/MiniProperty.rb', line 57

def title
  @row[@idx_title]
end

#typeObject



24
25
26
# File 'lib/sawa/MiniProperty.rb', line 24

def type
  @row[@idx_type]
end

#type_jsObject



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/sawa/MiniProperty.rb', line 32

def type_js
  if @row[@idx_type] == "java.lang.String"
    return "txt"
  end
  if @row[@idx_type] == "java.lang.Integer" or @row[@idx_type] == "java.lang.Short" or @row[@idx_type] == "java.lang.Long" or @row[@idx_type] == "java.lang.Float" or @row[@idx_type] == "java.lang.Double"
    return "num"
  end
  if @row[@idx_type].start_with?("java.util.List")
    return "list"
  end
  return "obj"
end

#uniqueObject



45
46
47
# File 'lib/sawa/MiniProperty.rb', line 45

def unique
  @row[@idx_unique] == "1"
end