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

org.zodiac.fastorm.rdb.mapping.EntityColumnMapping Maven / Gradle / Ivy

The newest version!
package org.zodiac.fastorm.rdb.mapping;

import org.zodiac.fastorm.core.meta.Feature;
import org.zodiac.fastorm.rdb.metadata.RDBColumnMetadata;
import org.zodiac.fastorm.rdb.metadata.TableOrViewMetadata;
import org.zodiac.sdk.toolkit.util.ExceptionUtil;

import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import java.util.Optional;

public interface EntityColumnMapping extends Feature {

    @Override
    default MappingFeatureType getType() {
        return MappingFeatureType.columnPropertyMapping;
    }

    Class getEntityType();

    Optional getColumnByProperty(String property);

    Optional getPropertyByColumnName(String columnName);

    Optional getColumnByName(String columnName);

    Map getColumnPropertyMapping();

    TableOrViewMetadata getTable();

    default Object newInstance() {
        Object result = null;
        try {
            result = getEntityType().getConstructor().newInstance();
        } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
            | NoSuchMethodException | SecurityException e) {
            ExceptionUtil.chuck(e);
        }
        return result;
    }

    default void reload(){
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy