Interface InstanceInitializer
- All Known Implementing Classes:
AbstractInstanceInitializer,DebuggerInstanceInitializer,DecoderIndexFile.Initializer,DefaultCatalogTreeManager.Initializer,DefaultIdTagManager.Initializer,DefaultInstanceInitializer,DeferringProgrammerManager.Initializer,EngineModels.Initializer,ImageIndexEditor.Initializer,JmriUserPreferencesManager.Initializer,LogixNG_AnalogInstanceInitializer,LogixNG_DigitalInstanceInitializer,LogixNG_InstanceInitializer,LogixNG_StringInstanceInitializer,NameFile.Initializer,PermissionInstanceInitializer,Server.Initializer,ServerFrame.Initializer,ShutDownManagerInitializer,TrackerTableAction.Initializer,WiThrottlePreferences.Initializer
Note that this is only needed when the object can't be created with a
no-arguments constructor. In that case, the
InstanceManagerAutoDefault mechanism is a better choice.
Instances of this class will normally be used only if they are annotated with
@ServiceProvider(service = InstanceInitializer.class)
JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- Since:
- 2.9.4
-
Method Summary
Modifier and TypeMethodDescription<T> ObjectgetDefault(Class<T> type) Provide a default instance of the given class.Get the set of classes for which this InstanceInitializer can provide default instances for.
-
Method Details
-
getDefault
Provide a default instance of the given class.Note calling this method twice for the same class should not be expected to return the same instance; however, there is no guarantee that the same instance will not be returned for two calls to this method.
- Type Parameters:
T- the class to get the default for- Parameters:
type- the class to get the default for- Returns:
- the newly created default for the given class
- Throws:
IllegalArgumentException- if creating an instance of type is not supported by this InstanceInitalizer
-
getInitalizes
Get the set of classes for which this InstanceInitializer can provide default instances for.- Returns:
- the set of classes this InstanceInitalizer supports; if empty,
getDefault(java.lang.Class)will never be called.
-