Package repast.simphony.engine.watcher
Class WatcheeDataFinder
- java.lang.Object
-
- repast.simphony.engine.watcher.WatcheeDataFinder
-
public class WatcheeDataFinder extends Object
Finds the Watchee info for instrumentation by searching paths for classes with @Watch annotations, as well as looking for specified watcher classes in those paths.- Author:
- Nick Collier
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
WatcheeDataFinder.FinderResult
-
Constructor Summary
Constructors Constructor Description WatcheeDataFinder(WatcheeInstrumentor watcheeInstrumentor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addClassToFind(String className, String fieldName)
Adds the named class as a Watchee to find and the specified field to watch.void
addPathToSearch(String path)
Adds fields and watchees to watch from any @Watch annotations on any class that this finds in the specified path.Iterable<WatcheeData>
data()
Gets an iteratable over the WatcheeData found and created by this WatcheeDataFinder.WatcheeDataFinder.FinderResult
run(String classpath, Filter<String> filter)
Finds @Watch annotations and creates WatcheeData from them.
-
-
-
Constructor Detail
-
WatcheeDataFinder
public WatcheeDataFinder(WatcheeInstrumentor watcheeInstrumentor)
-
-
Method Detail
-
addClassToFind
public void addClassToFind(String className, String fieldName)
Adds the named class as a Watchee to find and the specified field to watch.- Parameters:
className
- the field's classfieldName
- the field to watch
-
addPathToSearch
public void addPathToSearch(String path)
Adds fields and watchees to watch from any @Watch annotations on any class that this finds in the specified path. The path can be a top level class directory of classes or a jar file.- Parameters:
path
-
-
run
public WatcheeDataFinder.FinderResult run(String classpath, Filter<String> filter) throws IOException, ClassNotFoundException
Finds @Watch annotations and creates WatcheeData from them.- Returns:
- a successful FinderResult if the run was successful and all classes that were tagged as watchees were found, otherwise an unsuccessful finder result with an explanatory message.
- Throws:
ClassNotFoundException
IOException
-
data
public Iterable<WatcheeData> data()
Gets an iteratable over the WatcheeData found and created by this WatcheeDataFinder. WatcheeData is ordered according to inheritence hierarchy such that parent classes will appear before their children.- Returns:
- an iteratable over the WatcheeData found and created by this WatcheeDataFinder.
-
-