rinde.sim.core.model.AbstractModel Maven / Gradle / Ivy
package rinde.sim.core.model;
import com.google.common.reflect.TypeToken;
/**
* Basic implementation that provides a getSupportedType method implementation.
* @author Bartosz Michalik
*
* @param The type that is supported by this model.
*/
public abstract class AbstractModel implements Model {
private final Class clazz;
/**
* Create a new model.
*/
@SuppressWarnings({ "serial", "unchecked" })
protected AbstractModel() {
this.clazz = (Class) new TypeToken(getClass()) {}.getRawType();
}
@Override
public final Class getSupportedType() {
return clazz;
}
}