Package ghidra.app.util.opinion
Class LoadResults<T extends DomainObject>
java.lang.Object
ghidra.app.util.opinion.LoadResults<T>
- Type Parameters:
T- The type ofDomainObjects that were loaded
The result of a
load.
A LoadResults object provides convenient access to and operations on the underlying
Loaded DomainObjects that got loaded.-
Constructor Summary
ConstructorsConstructorDescriptionLoadResults(List<Loaded<T>> loadedList) LoadResults(T domainObject, String name, String projectFolderPath) Creates a newLoadResultsthat contains a newLoadedDomainObjectcreated from the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionGets the "primary"DomainObject, who's meaning is defined by eachLoaderimplementationiterator()voidNotify all of theLoadedDomainObjects that the specified consumer is no longer using them.voidNotify the filteredLoadedDomainObjects that the specified consumer is no longer using them.voidreleaseNonPrimary(Object consumer) Notify the non-primaryLoadedDomainObjects that the specified consumer is no longer using them.voidsave(Project project, Object consumer, MessageLog messageLog, TaskMonitor monitor) intsize()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
LoadResults
Creates a newLoadResultsthat contains the given non-emptyListofLoadedDomainObjects. The first entry in theListis assumed to be theprimaryLoadedDomainObject.- Parameters:
loadedList- AListofLoadedDomainObjects- Throws:
IllegalArgumentException- if the providedListis null or empty
-
LoadResults
Creates a newLoadResultsthat contains a newLoadedDomainObjectcreated from the given parameters. This newLoadedDomainObjectis assumed to be theprimaryLoadedDomainObject.- Parameters:
domainObject- The loadedDomainObjectname- The name of the loadedDomainObject. If asaveoccurs, this will attempted to be used for the resultingDomainFile's name.projectFolderPath- The project folder path this will get saved to during asaveoperation. If null or empty, the root project folder will be used.
-
-
Method Details
-
getPrimary
- Returns:
- The "primary"
LoadedDomainObject
-
getPrimaryDomainObject
Gets the "primary"DomainObject, who's meaning is defined by eachLoaderimplementation- Returns:
- The "primary"
DomainObject
-
size
public int size()Gets the number ofLoadedDomainObjects in thisLoadResults. The size will always be greater than 0.- Returns:
- The number of
LoadedDomainObjects in thisLoadResults
-
save
public void save(Project project, Object consumer, MessageLog messageLog, TaskMonitor monitor) throws CancelledException, IOException SaveseachLoadedDomainObjectto the givenProject.NOTE: If any fail to save, none will be saved (already saved
DomainFiles will be cleaned up/deleted), and allLoadedDomainObjects will have beenreleased.- Parameters:
project- TheProjectto save toconsumer- the consumermessageLog- The logmonitor- A cancelable task monitor- Throws:
CancelledException- if the operation was cancelledIOException- If there was a problem saving- See Also:
-
release
Notify all of theLoadedDomainObjects that the specified consumer is no longer using them. When the last consumer invokes this method, theLoadedDomainObjects will be closed and will become invalid.- Parameters:
consumer- the consumer
-
release
Notify the filteredLoadedDomainObjects that the specified consumer is no longer using them. When the last consumer invokes this method, the filteredLoadedDomainObjects will be closed and will become invalid.- Parameters:
consumer- the consumerfilter- a filter to apply to theLoadedDomainObjects prior to the release
-
releaseNonPrimary
Notify the non-primaryLoadedDomainObjects that the specified consumer is no longer using them. When the last consumer invokes this method, the non-primaryLoadedDomainObjects will be closed and will become invalid.- Parameters:
consumer- the consumer
-
iterator
- Specified by:
iteratorin interfaceIterable<T extends DomainObject>
-