当前位置: 首页>>代码示例>>Java>>正文


Java Entity.name方法代码示例

本文整理汇总了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();
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:EntityBinder.java

示例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.");
}
 
开发者ID:PatternFM,项目名称:tokamak,代码行数:8,代码来源:UniqueValueValidator.java

示例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();
    }
}
 
开发者ID:xiaolongzuo,项目名称:niubi-job,代码行数:9,代码来源:BaseDaoImpl.java

示例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();
}
 
开发者ID:herolynx,项目名称:jsql,代码行数:15,代码来源:GrammarUtil.java

示例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();
}
 
开发者ID:ddRPB,项目名称:rpb,代码行数:8,代码来源:JpaUniqueUtil.java

示例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();
}
 
开发者ID:ctripcorp,项目名称:dal,代码行数:10,代码来源:EntityManager.java

示例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;
}
 
开发者ID:pengqiuyuan,项目名称:g2,代码行数:10,代码来源:GenericRepositoryImpl.java

示例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;
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:JpaPollingConsumer.java

示例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;
        }

    }
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:QueryUtils.java

示例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;
}
 
开发者ID:sdgas,项目名称:contract,代码行数:12,代码来源:DaoSupport.java

示例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();
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:JpaTckRepository.java

示例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);
    }
}
 
开发者ID:yahoo,项目名称:elide,代码行数:51,代码来源:EntityDictionary.java


注:本文中的javax.persistence.Entity.name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。