All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.n2oapp.framework.api.metadata.aware.ElementClassAware Maven / Gradle / Ivy

There is a newer version: 7.28.2
Show newest version
package net.n2oapp.framework.api.metadata.aware;

import net.n2oapp.framework.api.exception.N2oException;
import org.jdom2.Element;

/**
 * Знание о типе сущности
 * @param  тип сущности
 */
public interface ElementClassAware {
    /**
     * @return тип сущности
     */
    Class getElementClass();

    /**
     * Создание инстанса сущности по элементу
     * @param element элемент
     * @return сущность
     */
    default T newInstance(Element element) {
        try {
            return getElementClass().newInstance();
        } catch (InstantiationException | IllegalAccessException e) {
            throw new N2oException(e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy