Class: Rubernate::ClassParser
- Inherits:
-
Object
- Object
- Rubernate::ClassParser
- Defined in:
- lib/rubernate/class_parser.rb
Instance Attribute Summary collapse
-
#bytecode ⇒ Object
Returns the value of attribute bytecode.
-
#clazz ⇒ Object
Returns the value of attribute clazz.
-
#proxy_class ⇒ Object
Returns the value of attribute proxy_class.
Instance Method Summary collapse
- #build_id_for(field) ⇒ Object
-
#initialize(clazz, bytecode) ⇒ ClassParser
constructor
A new instance of ClassParser.
-
#initialize_simples ⇒ Object
TODO need to correct this behaivor.
- #name ⇒ Object
- #to_class ⇒ Object
Constructor Details
#initialize(clazz, bytecode) ⇒ ClassParser
Returns a new instance of ClassParser.
7 8 9 10 11 12 13 |
# File 'lib/rubernate/class_parser.rb', line 7 def initialize(clazz,bytecode) puts "Class" self.clazz = clazz self.bytecode = bytecode self.proxy_class = bytecode.create_class(name) initialize_simples end |
Instance Attribute Details
#bytecode ⇒ Object
Returns the value of attribute bytecode.
5 6 7 |
# File 'lib/rubernate/class_parser.rb', line 5 def bytecode @bytecode end |
#clazz ⇒ Object
Returns the value of attribute clazz.
5 6 7 |
# File 'lib/rubernate/class_parser.rb', line 5 def clazz @clazz end |
#proxy_class ⇒ Object
Returns the value of attribute proxy_class.
5 6 7 |
# File 'lib/rubernate/class_parser.rb', line 5 def proxy_class @proxy_class end |
Instance Method Details
#build_id_for(field) ⇒ Object
27 28 29 |
# File 'lib/rubernate/class_parser.rb', line 27 def build_id_for(field) self.proxy_class.add_annotation field,"javax.persistence.Id" end |
#initialize_simples ⇒ Object
TODO need to correct this behaivor
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rubernate/class_parser.rb', line 16 def initialize_simples clazz.fields.each do |field| proxy_field = proxy_class.add_simple(field[:type],field[:name].to_s) field[:args].each do |f1| if f1.length > 0 build_id_for proxy_field if f1[0][:id] end end end end |
#name ⇒ Object
33 34 35 |
# File 'lib/rubernate/class_parser.rb', line 33 def name self.clazz.name end |
#to_class ⇒ Object
37 38 39 |
# File 'lib/rubernate/class_parser.rb', line 37 def to_class self.proxy_class.to_class end |