cn.featherfly.component.sorm.mapping.ClassTableNameJpaFactory Maven / Gradle / Ivy
package cn.featherfly.component.sorm.mapping;
import javax.persistence.Table;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import cn.featherfly.common.bean.BeanDescriptor;
/**
*
* ClassTableMapping jpa impl. use javax.persistence.Table
*
*
* @author 钟冀
*/
public class ClassTableNameJpaFactory implements ClassTableNameFactory{
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
* {@inheritDoc}
*/
@Override
public String getMappingTableName(Class type) {
BeanDescriptor bd = BeanDescriptor.getBeanDescriptor(type);
Table table = bd.getAnnotation(Table.class);
if (table != null) {
return table.name();
}
return null;
}
}