本文整理汇总了Java中javax.persistence.Entity.name方法的典型用法代码示例。如果您正苦于以下问题:Java Entity.name方法的具体用法?Java Entity.name怎么用?Java Entity.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.persistence.Entity
的用法示例。
在下文中一共展示了Entity.name方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bindEjb3Annotation
import javax.persistence.Entity; //导入方法依赖的package包/类
private void bindEjb3Annotation(Entity ejb3Ann) {
if ( ejb3Ann == null ) throw new AssertionFailure( "@Entity should always be not null" );
if ( BinderHelper.isEmptyAnnotationValue( ejb3Ann.name() ) ) {
name = StringHelper.unqualify( annotatedClass.getName() );
}
else {
name = ejb3Ann.name();
}
}
示例2: getTableName
import javax.persistence.Entity; //导入方法依赖的package包/类
private String getTableName(PersistentEntity entity) {
if (entity.getClass().isAnnotationPresent(Entity.class)) {
Entity annotation = entity.getClass().getAnnotation(Entity.class);
return annotation.name();
}
throw new IllegalStateException(entity.getClass().getSimpleName() + " must have an @Entity annotation configured with the entity name.");
}
示例3: getEntityAnnotationName
import javax.persistence.Entity; //导入方法依赖的package包/类
public String getEntityAnnotationName(Class<?> clazz) {
try {
Entity entityAnnotation = clazz.getAnnotation(Entity.class);
return StringHelper.isEmpty(entityAnnotation.name()) ? clazz.getSimpleName() : entityAnnotation.name();
} catch (Exception e) {
return clazz.getSimpleName();
}
}
示例4: getTableName
import javax.persistence.Entity; //导入方法依赖的package包/类
/**
* Get table name.
*
*
* @return name Entity annotation or class name if entity annotation is not
* defined
*/
public static String getTableName(final Table table) {
Entity entityAnno = table.getTableClass().getAnnotation(Entity.class);
if (entityAnno != null && !entityAnno.name().isEmpty()) {
return entityAnno.name();
}
return table.getTableClass().getSimpleName();
}
示例5: getEntityName
import javax.persistence.Entity; //导入方法依赖的package包/类
private String getEntityName(Identifiable<?> entity) {
Entity entityAnnotation = findAnnotation(entity.getClass(), Entity.class);
if (isBlank(entityAnnotation.name())) {
return getClassWithoutInitializingProxy(entity).getSimpleName();
}
return entityAnnotation.name();
}
示例6: getTableName
import javax.persistence.Entity; //导入方法依赖的package包/类
public <T> String getTableName() {
Table table = clazz.getAnnotation(Table.class);
if (table != null && table.name() != null)
return table.name();
Entity entity = clazz.getAnnotation(Entity.class);
if ( entity != null && (!entity.name().isEmpty()) )
return entity.name();
return clazz.getSimpleName();
}
示例7: getEntityName
import javax.persistence.Entity; //导入方法依赖的package包/类
@Override
public String getEntityName(Class<T> entityClass) {
String entityname = entityClass.getSimpleName();
Entity entity = entityClass.getAnnotation(Entity.class);
if(entity.name()!=null && !"".equals(entity.name())){
entityname = entity.name();
}
return entityname;
}
示例8: getEntityName
import javax.persistence.Entity; //导入方法依赖的package包/类
protected String getEntityName(Class<?> clazz) {
Entity entity = clazz.getAnnotation(Entity.class);
// Check if the property name has been defined for Entity annotation
if (entity != null && !entity.name().equals("")) {
return entity.name();
} else {
return null;
}
}
示例9: getEntityName
import javax.persistence.Entity; //导入方法依赖的package包/类
protected static String getEntityName(Class<?> clazz) {
Entity entity = clazz.getAnnotation(Entity.class);
// Check if the property name has been defined for Entity annotation
if (!entity.name().equals("")) {
return entity.name();
} else {
return null;
}
}
示例10: getEntityName
import javax.persistence.Entity; //导入方法依赖的package包/类
/**
* 获取实体名称
*/
protected <T> String getEntityName(Class<T> entityClass) {
String enetityName = entityClass.getName();
Entity entity = entityClass.getAnnotation(Entity.class);
if (entity.name() != null && !"".equals(entity.name())) {
enetityName = entity.name();
}
return enetityName;
}
示例11: getEntityName
import javax.persistence.Entity; //导入方法依赖的package包/类
private String getEntityName(Class<?> clazz) {
if (!clazz.isAnnotationPresent(Entity.class)) {
return clazz.getSimpleName();
}
final Entity entity = clazz.getAnnotation(Entity.class);
if (entity.name().isEmpty()) {
return clazz.getSimpleName();
}
return entity.name();
}
示例12: bindEntity
import javax.persistence.Entity; //导入方法依赖的package包/类
/**
* Add given Entity bean to dictionary.
*
* @param cls Entity bean class
*/
public void bindEntity(Class<?> cls) {
if (entityBindings.containsKey(lookupEntityClass(cls))) {
return;
}
Annotation annotation = getFirstAnnotation(cls, Arrays.asList(Include.class, Exclude.class));
Include include = annotation instanceof Include ? (Include) annotation : null;
Exclude exclude = annotation instanceof Exclude ? (Exclude) annotation : null;
Entity entity = (Entity) getFirstAnnotation(cls, Arrays.asList(Entity.class));
if (exclude != null) {
log.trace("Exclude {}", cls.getName());
return;
}
if (include == null) {
log.trace("Missing include {}", cls.getName());
return;
}
String name;
if (entity == null || "".equals(entity.name())) {
name = StringUtils.uncapitalize(cls.getSimpleName());
} else {
name = entity.name();
}
String type;
if ("".equals(include.type())) {
type = name;
} else {
type = include.type();
}
Class<?> duplicate = bindJsonApiToEntity.put(type, cls);
if (duplicate != null && !duplicate.equals(cls)) {
log.error("Duplicate binding {} for {}, {}", type, cls, duplicate);
throw new DuplicateMappingException(type + " " + cls.getName() + ":" + duplicate.getName());
}
entityBindings.putIfAbsent(lookupEntityClass(cls), new EntityBinding(this, cls, type, name));
if (include.rootLevel()) {
bindEntityRoots.add(cls);
}
}