23 lines
714 B
Java
23 lines
714 B
Java
package eu.eudat.model.publicapi;
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
|
public class HintedModelFactory {
|
|
private static final Logger logger = LoggerFactory.getLogger(HintedModelFactory.class);
|
|
|
|
public static <T extends DataModel<?,?>> String getHint(Class<T> clazz) {
|
|
try {
|
|
return clazz.getDeclaredConstructor().newInstance().getHint();
|
|
} catch (InstantiationException | IllegalAccessException e) {
|
|
logger.error(e.getMessage(), e);
|
|
return null;
|
|
} catch (InvocationTargetException | NoSuchMethodException e) {
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
}
|