Sha256: 2baa39898d039c360ee6e8ed892e21fde1b2cc4fc532c7073f981f6211a390f7

Contents?: true

Size: 782 Bytes

Versions: 2

Compression:

Stored size: 782 Bytes

Contents

class ObjectifyModelGenerator < BaseScaffold

  def self.source_root
    File.join File.dirname(__FILE__), "templates"
  end

  def build
    template("objectify_model.erb", Configuration.main_class_path(Configuration.models_package, "#{class_name}.java"))
    template("model_test.erb", Configuration.test_class_path(Configuration.models_package, "#{test_class_name}.java"))
    map_model_class
  end

  private
  def map_model_class
    file = File.join Configuration::main_class_path, "infra", "ObjectifyFactory.java"
    model = "#{Configuration.full_models_package}.#{class_name}"
    inject_into_file(file, "import #{model};\n\n", :before => "@Component")
    inject_into_file(file, "\t\tObjectifyService.register(#{class_name}.class);\n", :after => "\tstatic {\n")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vraptor-scaffold-1.3.0 lib/vraptor-scaffold/generators/scaffold/model_generator/objectify_model_generator.rb
vraptor-scaffold-1.3.0.rc lib/vraptor-scaffold/generators/scaffold/model_generator/objectify_model_generator.rb