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, #controller_test_param, #imports, #initialize, #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

- (Object) build



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

- (Object) orm_class



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

def orm_class
  orm_parameter_name.camelize
end

- (Object) orm_import



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

- (Object) orm_parameter_name



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

- (Object) source_root



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

- (Object) template_path



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

def template_path
  "src/templates/repositories"
end