Class: JAXB2Ruby::Converter

Inherits:
Object
  • Object
show all
Defined in:
lib/jaxb2ruby/converter.rb

Overview

:nodoc:

Constant Summary collapse

XML_NULL =
"\u0000"
XML_ANNOT_DEFAULT =
"##default"

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema, options = {}) ⇒ Converter

Returns a new instance of Converter.

Raises:

  • (ArgumentError)


17
18
19
20
21
22
23
24
25
# File 'lib/jaxb2ruby/converter.rb', line 17

def initialize(schema, options = {})
  raise ArgumentError, "cannot access schema: #{schema}" unless File.file?(schema) and File.readable?(schema)
  @xjc = XJC.new(schema, :xjc => options[:xjc], :wsdl => !!options[:wsdl], :jvm => options[:jvm], bindings: options[:bindings])

  @namespace = options[:namespace] || {}
  raise ArgumentError, "namespace mapping must be a Hash" unless @namespace.is_a?(Hash)

  @typemap = TypeUtil.new(options[:typemap])
end

Class Method Details

.convert(schema, options = {}) ⇒ Object



13
14
15
# File 'lib/jaxb2ruby/converter.rb', line 13

def self.convert(schema, options = {})
  new(schema, options).convert
end

Instance Method Details

#convertObject



27
28
29
30
# File 'lib/jaxb2ruby/converter.rb', line 27

def convert
  create_java_classes
  create_ruby_classes
end