Class: Rubernate::Bytecode
- Inherits:
-
Object
- Object
- Rubernate::Bytecode
- Defined in:
- lib/rubernate/bytecode.rb
Overview
This utilit class creates the java ‘classes’
Defined Under Namespace
Classes: ProxyClass
Constant Summary collapse
- DEFAULT_NAMESPACE =
NOT IMPLEMENTED
"rubernate.models"
Instance Attribute Summary collapse
-
#class_pool ⇒ Object
Returns the value of attribute class_pool.
Class Method Summary collapse
Instance Method Summary collapse
- #create_class(name) ⇒ Object
-
#initialize ⇒ Bytecode
constructor
A new instance of Bytecode.
Constructor Details
#initialize ⇒ Bytecode
Returns a new instance of Bytecode.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rubernate/bytecode.rb', line 13 def initialize java_import 'javassist.CtClass' @@mapped_types = Hash[:integer => "Integer" , :long => "Long", :short => "Short", :float => "Float", :double => "Double", :string => "String" , :char => "char", :boolean=> "Boolean"] end |
Instance Attribute Details
#class_pool ⇒ Object
Returns the value of attribute class_pool.
8 9 10 |
# File 'lib/rubernate/bytecode.rb', line 8 def class_pool @class_pool end |
Class Method Details
.mapped_types ⇒ Object
27 28 29 |
# File 'lib/rubernate/bytecode.rb', line 27 def mapped_types @@mapped_types end |
Instance Method Details
#create_class(name) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/rubernate/bytecode.rb', line 34 def create_class(name) java_import 'javassist.ClassPool' java_import 'javassist.CtClass' java_import 'javax.persistence.Entity' self.class_pool = ClassPool.get_default ProxyClass.new(self.class_pool.makeClass("#{name}")) end |