Class: Jaspion::Kilza::Java
- Inherits:
-
Object
- Object
- Jaspion::Kilza::Java
- Includes:
- Language
- Defined in:
- lib/jaspion/kilza/language/java.rb,
lib/jaspion/kilza/language/java.rb
Overview
Objective-C Language parser
Defined Under Namespace
Classes: Class
Instance Attribute Summary
Attributes included from Language
#base_name, #equal_keys, #json_string, #reserved_delimiter, #reserved_words, #types
Instance Method Summary collapse
- #classes(class_name) ⇒ Object
- #clazz(name) ⇒ Object
-
#initialize(json_string) ⇒ Java
constructor
A new instance of Java.
Constructor Details
#initialize(json_string) ⇒ Java
Returns a new instance of Java.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/jaspion/kilza/language/java.rb', line 31 def initialize(json_string) super(json_string) @reserved_words = %w( abstract continue for new switch assert default goto, package synchronized boolean do if private this break double implements, protected throw byte else import public throws case enum instanceof, null return transient catch extends int short try char final interface static, void class finally long strictfp volatile const float native super while ) @types = { 'nilclass' => 'Object', 'string' => 'String', 'fixnum' => 'Long', 'float' => 'Double', 'falseclass' => 'Boolean', 'trueclass' => 'Boolean', 'hash' => 'Object' } @equal_keys = %w(id identifier uid) end |
Instance Method Details
#classes(class_name) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/jaspion/kilza/language/java.rb', line 59 def classes(class_name) super(class_name) @classes.each do |cl| cl.properties.each do |pr| pr.type = pr.name.capitalize if pr.object? || (pr.array? && pr.null?) cl.imports.push('import java.util.ArrayList;') if pr.array? && cl.imports.index('import java.util.ArrayList;').nil? pr.type = @types[pr.type] unless @types[pr.type].nil? end end end |