Class: JavaClass::Dsl::LoadingClasspath

Inherits:
SimpleDelegator
  • Object
show all
Includes:
ClassScanner::Scanners, ClasspathAnalysers, Loader
Defined in:
lib/javaclass/dsl/loading_classpath.rb,
lib/javaclass/dsl/classpath_analysers.rb

Overview

A delegator Classpath that loads and parses classes.

Author

Peter Kofler

Instance Method Summary collapse

Methods included from Analyse::TransitiveDependencies

#transitive_dependencies_package, #transitive_dependency_tree

Methods included from Analyse::Dependencies

#external_types, #types, #used_types, #used_types_map

Methods included from ClassScanner::Scanners

#analyse

Methods included from Loader

#disassemble, #load_cp, #load_fs

Constructor Details

#initialize(classpath) ⇒ LoadingClasspath

Create a lading instance of the classpath .



13
14
15
16
17
18
# File 'lib/javaclass/dsl/loading_classpath.rb', line 13

def initialize(classpath)
  unless classpath.respond_to? :load_binary 
    raise ArgumentError, "wrong type of delegatee #{classpath.class}"
  end
  super(classpath)
end

Instance Method Details

#load(classname) ⇒ Object

Read and disassemble the given class classname .



21
22
23
# File 'lib/javaclass/dsl/loading_classpath.rb', line 21

def load(classname)
  analyse(load_cp(classname, self))
end

#values(listed = nil, &filter) ⇒ Object

Load listed or all classes and return the list of them. An additional block is used as filter on class names.



26
27
28
29
# File 'lib/javaclass/dsl/loading_classpath.rb', line 26

def values(listed=nil, &filter)
  listed ||= names(&filter)
  listed.collect { |name| load(name) }
end