Class: RepositoryGenerator

Inherits:
BaseScaffold show all
Defined in:
lib/vraptor-scaffold/generators/scaffold/repository_generator/repository_generator.rb

Instance Method Summary collapse

Methods inherited from BaseScaffold

#base_path, #class_name, #controller_class_name, #controller_test_class_name, #initialize, #model_list_name, #model_parameter_name, #repository_impl_name, #repository_interface_name, #repository_test_class_name, #test_class_name

Constructor Details

This class inherits a constructor from BaseScaffold

Instance Method Details

#buildObject



3
4
5
6
7
8
# File 'lib/vraptor-scaffold/generators/scaffold/repository_generator/repository_generator.rb', line 3

def build
  define_source_paths
  template("repository.erb", Configuration.main_class_path(Configuration.repositories_package, "#{repository_interface_name}.java"))
  template("repository_impl.erb", Configuration.main_class_path(Configuration.repositories_package, "#{repository_impl_name}.java"))
  template("repository_test.erb", Configuration.test_class_path(Configuration.repositories_package, "#{repository_test_class_name}.java"))
end

#orm_classObject



20
21
22
# File 'lib/vraptor-scaffold/generators/scaffold/repository_generator/repository_generator.rb', line 20

def orm_class
  orm_parameter_name.camelize
end

#orm_importObject



10
11
12
13
# File 'lib/vraptor-scaffold/generators/scaffold/repository_generator/repository_generator.rb', line 10

def orm_import
  return "org.hibernate.Session" if Configuration.hibernate?
  "javax.persistence.EntityManager"
end

#orm_parameter_nameObject



15
16
17
18
# File 'lib/vraptor-scaffold/generators/scaffold/repository_generator/repository_generator.rb', line 15

def orm_parameter_name
  return "session" if Configuration.hibernate?
  "entityManager"
end

#source_rootObject



28
29
30
# File 'lib/vraptor-scaffold/generators/scaffold/repository_generator/repository_generator.rb', line 28

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

#template_pathObject



24
25
26
# File 'lib/vraptor-scaffold/generators/scaffold/repository_generator/repository_generator.rb', line 24

def template_path
  "src/templates/repositories"
end