public static <T> T createInstance(T impl, String name, String category, String subsystem, IOnDemandCallHandler handler, IOnDemandStatsFactory<? extends IStats> statsFactory,  boolean attachLoggers, Class<T> interf, Class<?>... additionalInterfaces){
		if (name==null)
			name = extractName(interf);

		Class<?>[] interfacesParameter = mergeInterfaces(interf, additionalInterfaces);
		@SuppressWarnings ("unchecked")
		final MoskitoInvokationProxy proxy = new MoskitoInvokationProxy(
				impl,
				handler,
				statsFactory,
				name+ '-' +getInstanceCounter(name),
				category,
				subsystem,
				interfacesParameter
			);
		
		@SuppressWarnings("unchecked")
		T ret = (T) proxy.createProxy();

		if (attachLoggers){
			LoggerUtil.createSLF4JDefaultAndIntervalStatsLogger(proxy.getProducer());
		}

		return ret;
	}
public static < T > T createInstance ( T impl , String name , String category , String subsystem , IOnDemandCallHandler handler , IOnDemandStatsFactory < ? extends IStats > statsFactory , boolean attachLoggers , Class < T > interf , Class < ? > ... additionalInterfaces ) { if ( name == null ) name = extractName ( interf ) ; Class < ? > [ ] interfacesParameter = mergeInterfaces ( interf , additionalInterfaces ) ; @ SuppressWarnings ( "unchecked" ) final MoskitoInvokationProxy proxy = new MoskitoInvokationProxy ( impl , handler , statsFactory , name + '-' + getInstanceCounter ( name ) , category , subsystem , interfacesParameter ) ; @ SuppressWarnings ( "unchecked" ) T ret = ( T ) proxy . createProxy ( ) ; if ( attachLoggers ) { LoggerUtil . createSLF4JDefaultAndIntervalStatsLogger ( proxy . getProducer ( ) ) ; } return ret ; }
Creates a new proxied instance for an existing implementation.
@param <T> interface type.
@param impl the implementation of the interface.
@param name name of the producer.
@param category category of the producer, i.e. service, dao, api, controller.
@param subsystem subsystem of the producer, i.e. messaging, payment, registration, shop.
@param handler handler for the calls.
@param statsFactory the factory for the stats.
@param attachLoggers if true loggers are attached.
@param interf interfaces.
@return a newly created proxy of type T.