Package jmri

Interface InstanceInitializer

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <T> java.lang.Object getDefault​(java.lang.Class<T> type)
      Provide a default instance of the given class.
      java.util.Set<java.lang.Class<?>> getInitalizes()
      Get the set of classes for which this InstanceInitializer can provide default instances for.
    • Method Detail

      • getDefault

        @Nonnull
        <T> java.lang.Object getDefault​(@Nonnull
                                        java.lang.Class<T> type)
        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:
        java.lang.IllegalArgumentException - if creating an instance of type is not supported by this InstanceInitalizer
      • getInitalizes

        @Nonnull
        java.util.Set<java.lang.Class<?>> 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.