Package jmri.profile
Class NullProfile
java.lang.Object
jmri.profile.Profile
jmri.profile.NullProfile
- All Implemented Interfaces:
Comparable<Profile>
An empty JMRI application profile. Profiles allow a JMRI application to load
completely separate set of preferences at each launch without relying on host
OS-specific tricks to ensure this happens.
A NullProfile allows an application using JMRI as a library to set the active JMRI profile to an identity set by that application, if the use of a standard JMRI profile is not acceptable.
This class deliberately overrides all methods of Profile
that access the name and id fields to remove protections
and restrictions on those fields.
-
Field Summary
Fields inherited from class jmri.profile.Profile
CONFIG, CONFIG_FILENAME, EXTENSION, ID, NAME, PATH, PROFILE, PROPERTIES, SHARED_CONFIG, SHARED_PROPERTIES, SHARED_UI_CONFIG, UI_CONFIG, UI_CONFIG_FILENAME -
Constructor Summary
ConstructorsConstructorDescriptionNullProfile(File path) Create a NullProfile object given just a path to it.NullProfile(File path, String id) Create a NullProfile object given just a path to it.NullProfile(String name, String id, File path) Create a Profile object and a profile in storage. -
Method Summary
-
Constructor Details
-
NullProfile
Create a NullProfile object given just a path to it. The Profile must exist in storage on the computer. Uses a random identity for the Profile.- Parameters:
path- The Profile's directory- Throws:
IOException- If path is not readable
-
NullProfile
Create a NullProfile object given just a path to it. The Profile must exist in storage on the computer.- Parameters:
path- The Profile's directoryid- The Profile's id- Throws:
IOException- If path is not readable
-
NullProfile
Create a Profile object and a profile in storage. A Profile cannot exist in storage on the computer at the path given. Since this is a new profile, the id must match the last element in the path.This is the only time the id can be set on a Profile, as the id becomes a read-only property of the Profile. The
ProfileManagerwill only load a single profile with a given id.- Parameters:
name- The name of the profile.id- If null,ProfileManager.createUniqueId()will be used to generate the id.path- The path where the profile is stored.- Throws:
IOException- If path is not readable.IllegalArgumentException- If a profile already exists at or within path
-
-
Method Details
-
toString
-
hashCode
-
equals
Description copied from class:ProfileThis tests for equal ID values -
isComplete
Test if the profile is complete.- Overrides:
isCompletein classProfile- Returns:
- always true for a NullProfile.
-
getUniqueId
Return the uniqueness portion of the Profile Id.- Overrides:
getUniqueIdin classProfile- Returns:
- The complete Id of a NullProfile.
-