Class: Liquigen::Scaffold::Entity
- Inherits:
-
Base
- Object
- Base
- Liquigen::Scaffold::Entity
show all
- Defined in:
- lib/liquigen/scaffold/entity.rb
Instance Attribute Summary
Attributes inherited from Base
#name, #props
Instance Method Summary
collapse
Methods inherited from Base
#directory, #file_append, #file_name, #initialize, #process, #write_lines
Instance Method Details
#class_lines ⇒ Object
25
26
27
28
29
30
31
32
33
|
# File 'lib/liquigen/scaffold/entity.rb', line 25
def class_lines
[
"@Entity(name = \"#{name.underscore.pluralize}\")",
'@Getter',
'@Setter',
'@Accessors(chain = true)',
"public class #{name.singularize.camelize} extends FakeDeleteBaseEntity {"
]
end
|
#current_package ⇒ Object
#import_lines ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/liquigen/scaffold/entity.rb', line 9
def import_lines
[
"package #{current_package};",
'import com.dyg.entity.FakeDeleteBaseEntity;',
'import lombok.Getter;',
'import lombok.Setter;',
'import lombok.experimental.Accessors;',
'',
'import javax.persistence.Entity;',
'import javax.persistence.OneToOne;',
'import javax.persistence.OneToMany;',
'import javax.persistence.ManyToMany;',
''
]
end
|
#methods_lines ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/liquigen/scaffold/entity.rb', line 35
def methods_lines
lines = []
skip_ones = %w[id created_at updated_at available]
props.each do |property|
key, value = property.to_s.split(':')
next if skip_ones.include?(key.underscore)
lines += [
'//@OneToOne',
"private #{Liquigen::TypeMap.new(value).java_type} #{key.camelize(:lower)};",
''
]
end
lines
end
|