Package ghidra.app.util.opinion
Class Loaded<T extends DomainObject>
java.lang.Object
ghidra.app.util.opinion.Loaded<T>
- Type Parameters:
T
- The type ofDomainObject
that was loaded
A loaded
DomainObject
produced by a Loader
. In addition to storing the loaded
DomainObject
, it also stores the Loader
's desired name and project folder path
for the loaded DomainObject
, should it get saved to a project.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets the loadedDomainObject
getName()
Gets the name of the loadedDomainObject
.Gets the project folder path this will get saved to during asave(Project, MessageLog, TaskMonitor)
operation.void
Notify the loadedDomainObject
that the specified consumer is no longer using it.save
(Project project, MessageLog messageLog, TaskMonitor monitor) Saves the loadedDomainObject
to the givenProject
at this object's project folder path, using this object's name.void
setProjectFolderPath
(String projectFolderPath) Sets the project folder path this will get saved to during asave(Project, MessageLog, TaskMonitor)
operation.toString()
-
Constructor Details
-
Loaded
Creates a newLoaded
object- Parameters:
domainObject
- The loadedDomainObject
name
- The name of the loadedDomainObject
. If asave(Project, MessageLog, TaskMonitor)
occurs, this will attempted to be used for the resultingDomainFile
's name.projectFolderPath
- The project folder path this will get saved to during asave(Project, MessageLog, TaskMonitor)
operation. If null or empty, the root project folder will be used.
-
-
Method Details
-
getDomainObject
Gets the loadedDomainObject
- Returns:
- The loaded
DomainObject
-
getName
Gets the name of the loadedDomainObject
. If asave(Project, MessageLog, TaskMonitor)
occurs, this will attempted to be used for the resultingDomainFile
's name.- Returns:
- the name of the loaded
DomainObject
-
getProjectFolderPath
Gets the project folder path this will get saved to during asave(Project, MessageLog, TaskMonitor)
operation.NOTE: The returned path will always end with a "/".
- Returns:
- the project folder path
-
setProjectFolderPath
Sets the project folder path this will get saved to during asave(Project, MessageLog, TaskMonitor)
operation.- Parameters:
projectFolderPath
- The project folder path this will get saved to during asave(Project, MessageLog, TaskMonitor)
operation. If null or empty, the root project folder will be used.
-
release
Notify the loadedDomainObject
that the specified consumer is no longer using it. When the last consumer invokes this method, the loadedDomainObject
will be closed and will become invalid.- Parameters:
consumer
- the consumer
-
save
public DomainFile save(Project project, MessageLog messageLog, TaskMonitor monitor) throws CancelledException, ClosedException, IOException Saves the loadedDomainObject
to the givenProject
at this object's project folder path, using this object's name.If a
DomainFile
already exists with the same desired name and project folder path, the desired name will get a counter value appended to it to avoid a naming conflict. Therefore, it should not be assumed that the returnedDomainFile
will have the same name as a call togetName()
.- Parameters:
project
- TheProject
to save tomessageLog
- The logmonitor
- A cancelable task monitor- Returns:
- The
DomainFile
where the save happened - Throws:
CancelledException
- if the operation was cancelledClosedException
- if the loadedDomainObject
was already closedIOException
- If there was an IO-related error, an invalid name was specified, or it was already successfully saved and still exists
-
getSavedDomainFile
- Returns:
- The loaded
DomainObject
's associated savedDomainFile
, or null if was not saved - Throws:
FileNotFoundException
- If the loadedDomainObject
was saved but the associatedDomainFile
no longer exists- See Also:
-
toString
-