mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/DependencyInjector.java
@SuppressWarnings("unchecked")
	public <T> T getInstanceOf(Class<? extends T> type) {
		if (isCustomInjectorDefined()) {
			return (T) customInjector.call(type);
		} else {
			try {
				// use default creation
				return type.newInstance();
			} catch (InstantiationException | IllegalAccessException e) {
				throw new RuntimeException("Can't create instance of type " + type.getName() +
						". Make sure that the class has a public no-arg constructor.", e);
			}
		}
	}
@SuppressWarnings("unchecked")
	public <T> T getInstanceOf(Class<? extends T> type) {
		if (isCustomInjectorDefined()) {
			return (T) customInjector.call(type);
		} else {
			try {
				// use default creation
				return type.newInstance();
			} catch (InstantiationException | IllegalAccessException e) {
				throw new RuntimeException("Can't create instance of type " + type.getName() +
						". Make sure that the class has a public no-arg constructor.", e);
			}
		}
	}
@ SuppressWarnings ( "unchecked" ) public < T > T getInstanceOf ( Class < ? extends T > type ) { if ( isCustomInjectorDefined ( ) ) { return ( T ) customInjector . call ( type ) ; } else { try { // use default creation return type . newInstance ( ) ; } catch ( InstantiationException | IllegalAccessException e ) { throw new RuntimeException ( "Can't create instance of type " + type . getName ( ) + ". Make sure that the class has a public no-arg constructor." , e ) ; } } }
Returns an instance of the given type. When there is a custom injector defined (See:
{@link #setCustomInjector(javafx.util.Callback)}) then this injector is used. Otherwise a new instance of the
desired type is created. This is done by a call to {@link Class#newInstance()} which means that all constraints
of the newInstance method are also need to be satisfied.

@param type
@param <T>
@return
Returns an instance of the given type . When there is a custom injector defined ( See : { @link #setCustomInjector ( javafx . util . Callback ) } ) then this injector is used . Otherwise a new instance of the desired type is created . This is done by a call to { @link Class#newInstance () } which means that all constraints of the newInstance method are also need to be satisfied .