package ru.nsu.ccfit.bogush.factory;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class Supplier<T extends CarFactoryObject> extends SimplePeriodical implements Runnable {
	private Storage<T> storage;
	private static final long DEFAULT_PERIOD = 0;
	private Class<T> thingClass;
	private Thread thread;

	private static final String LOGGER_NAME = "Supplier";
	private static final Logger logger = LogManager.getLogger(LOGGER_NAME);

	public Supplier(Storage<T> storage, Class<T> thingClass) {
		this(storage, thingClass, DEFAULT_PERIOD);
	}

	public Supplier(Storage<T> storage, Class<T> thingClass, long period) {
		super(period);
		logger.trace("initialize with period " + period);
		this.storage = storage;
		this.thingClass = thingClass;
		this.thread = new Thread(this);
		thread.setName(toString());
	}

	@Override
	public void run() {
		while (true) {
			try {
				storage.store(thingClass.newInstance());
				waitPeriod();
			} catch (InterruptedException | IllegalAccessException | InstantiationException e) {
				e.printStackTrace();
			}
		}
	}

	@Override
	public String toString() {
		return getClass().getSimpleName() + "-" + thread.getId();
	}

	public Thread getThread() {
		return thread;
	}
}

@@ -307,26 +307,27 @@
 lass%3CT%3E 
-thingClass
+contentType
 ;%0A%09priva
@@ -520,26 +520,27 @@
 lass%3CT%3E 
-thingClass
+contentType
 ) %7B%0A%09%09th
@@ -551,26 +551,27 @@
 torage, 
-thingClass
+contentType
 , DEFAUL
@@ -631,26 +631,27 @@
 lass%3CT%3E 
-thingClass
+contentType
 , long p
@@ -765,31 +765,33 @@
 his.
-thingClass = thingClass
+contentType = contentType
 ;%0A%09%09
@@ -936,18 +936,19 @@
 ore(
-thingClass
+contentType
 .new
@@ -1151,16 +1151,52 @@
 %09%09return
+ contentType.getSimpleName() + %22-%22 +
  getClas

Change toString() Rename field thingClass to contentType