Package ghidra.app.util.opinion
Class LoadResults<T extends DomainObject>
java.lang.Object
ghidra.app.util.opinion.LoadResults<T>
- Type Parameters:
T
- The type ofDomainObject
s that were loaded
The result of a
load
.
A LoadResults
object provides convenient access to and operations on the underlying
Loaded
DomainObject
s that got loaded.-
Constructor Summary
ConstructorDescriptionLoadResults
(List<Loaded<T>> loadedList) LoadResults
(T domainObject, String name, String projectFolderPath) Creates a a newLoadResults
that contains a newLoaded
DomainObject
created from the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionGets the "primary"DomainObject
, who's meaning is defined by eachLoader
implementationiterator()
void
Notify all of theLoaded
DomainObject
s that the specified consumer is no longer using them.void
Notify the filteredLoaded
DomainObject
s that the specified consumer is no longer using them.void
releaseNonPrimary
(Object consumer) Notify the non-primaryLoaded
DomainObject
s that the specified consumer is no longer using them.void
save
(Project project, Object consumer, MessageLog messageLog, TaskMonitor monitor) int
size()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
LoadResults
Creates a newLoadResults
that contains the given non-emptyList
ofLoaded
DomainObject
s. The first entry in theList
is assumed to be theprimary
Loaded
DomainObject
.- Parameters:
loadedList
- AList
ofLoaded
DomainObject
s- Throws:
IllegalArgumentException
- if the providedList
is null or empty
-
LoadResults
Creates a a newLoadResults
that contains a newLoaded
DomainObject
created from the given parameters. This newLoaded
DomainObject
is assumed to be theprimary
Loaded
DomainObject
.- Parameters:
domainObject
- The loadedDomainObject
name
- The name of the loadedDomainObject
. If asave
occurs, this will attempted to be used for the resultingDomainFile
's name.projectFolderPath
- The project folder path this will get saved to during asave
operation. If null or empty, the root project folder will be used.
-
-
Method Details
-
getPrimary
- Returns:
- The "primary"
Loaded
DomainObject
-
getPrimaryDomainObject
Gets the "primary"DomainObject
, who's meaning is defined by eachLoader
implementation- Returns:
- The "primary"
DomainObject
-
size
public int size()Gets the number ofLoaded
DomainObject
s in thisLoadResults
. The size will always be greater than 0.- Returns:
- The number of
Loaded
DomainObject
s in thisLoadResults
-
save
public void save(Project project, Object consumer, MessageLog messageLog, TaskMonitor monitor) throws CancelledException, IOException Saves
eachLoaded
DomainObject
to the givenProject
.NOTE: If any fail to save, none will be saved (already saved
DomainFile
s will be cleaned up/deleted), and allLoaded
DomainObject
s will have beenreleased
.- Parameters:
project
- TheProject
to 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 theLoaded
DomainObject
s that the specified consumer is no longer using them. When the last consumer invokes this method, theLoaded
DomainObject
s will be closed and will become invalid.- Parameters:
consumer
- the consumer
-
release
Notify the filteredLoaded
DomainObject
s that the specified consumer is no longer using them. When the last consumer invokes this method, the filteredLoaded
DomainObject
s will be closed and will become invalid.- Parameters:
consumer
- the consumerfilter
- a filter to apply to theLoaded
DomainObject
s prior to the release
-
releaseNonPrimary
Notify the non-primaryLoaded
DomainObject
s that the specified consumer is no longer using them. When the last consumer invokes this method, the non-primaryLoaded
DomainObject
s will be closed and will become invalid.- Parameters:
consumer
- the consumer
-
iterator
- Specified by:
iterator
in interfaceIterable<T extends DomainObject>
-