javax.persistence.Entity.name()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(144)

本文整理了Java中javax.persistence.Entity.name()方法的一些代码示例,展示了Entity.name()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.name()方法的具体详情如下:
包路径:javax.persistence.Entity
类名称:Entity
方法名:name

Entity.name介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-data-jpa

@Override
  public String getEntityName() {

    Entity entity = AnnotatedElementUtils.findMergedAnnotation(domainType, Entity.class);
    return null != entity && StringUtils.hasText(entity.name()) ? entity.name() : domainType.getSimpleName();
  }
}

代码示例来源:origin: hibernate/hibernate-orm

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();
  }
}

代码示例来源:origin: hibernate/hibernate-orm

private Entity getEntity(Element tree, XMLContext.Default defaults) {
  if ( tree == null ) {
    return defaults.canUseJavaAnnotations() ? getPhysicalAnnotation( Entity.class ) : null;
  }
  else {
    if ( "entity".equals( tree.getName() ) ) {
      AnnotationDescriptor entity = new AnnotationDescriptor( Entity.class );
      copyStringAttribute( entity, tree, "name", false );
      if ( defaults.canUseJavaAnnotations()
          && StringHelper.isEmpty( (String) entity.valueOf( "name" ) ) ) {
        Entity javaAnn = getPhysicalAnnotation( Entity.class );
        if ( javaAnn != null ) {
          entity.setValue( "name", javaAnn.name() );
        }
      }
      return AnnotationFactory.create( entity );
    }
    else {
      return null; //this is not an entity
    }
  }
}

代码示例来源:origin: Impetus/Kundera

/**
 * @param clazz
 */
private String getEntityName(Class<?> clazz)
{
  return !StringUtils.isBlank(clazz.getAnnotation(Entity.class).name()) ? clazz.getAnnotation(Entity.class)
      .name() : clazz.getSimpleName();
}

代码示例来源:origin: Impetus/Kundera

String annotateEntityName = clazz.getAnnotation(Entity.class).name();
if (!StringUtils.isBlank(annotateEntityName))

代码示例来源:origin: org.hibernate/hibernate-annotations

private void bindEjb3Annotation(Entity ejb3Ann) {
  if ( ejb3Ann == null ) throw new AssertionFailure( "@Entity should always be not null" );
  if ( BinderHelper.isDefault( ejb3Ann.name() ) ) {
    name = StringHelper.unqualify( annotatedClass.getName() );
  }
  else {
    name = ejb3Ann.name();
  }
}

代码示例来源:origin: org.hibernate/hibernate-annotations

private Entity getEntity(Element tree, XMLContext.Default defaults) {
  if ( tree == null ) {
    return defaults.canUseJavaAnnotations() ? getJavaAnnotation( Entity.class ) : null;
  }
  else {
    if ( "entity".equals( tree.getName() ) ) {
      AnnotationDescriptor entity = new AnnotationDescriptor( Entity.class );
      copyStringAttribute( entity, tree, "name", false );
      if ( defaults.canUseJavaAnnotations()
          && StringHelper.isEmpty( (String) entity.valueOf( "name" ) ) ) {
        Entity javaAnn = getJavaAnnotation( Entity.class );
        if ( javaAnn != null ) entity.setValue( "name", javaAnn.name() );
      }
      return AnnotationFactory.create( entity );
    }
    else {
      return null; //this is not an entity
    }
  }
}

代码示例来源:origin: br.com.jarch/jarch-utils

public static String aliasEntity(Class<?> clazz) {
    Entity anotacao = clazz.getAnnotation(Entity.class);

    return anotacao.name() == null || anotacao.name().isEmpty()
//                ? CaracterUtils.firstCaracterLowerCase(clazz.getSimpleName())
        ? clazz.getSimpleName()
        : anotacao.name();
  }

代码示例来源:origin: br.com.jarch/jarch-utils

public static String nameEntity(Class<?> clazz) {
  Entity anotacao = clazz.getAnnotation(Entity.class);
  if (anotacao.name() == null || anotacao.name().isEmpty()) {
    return clazz.getName();
  }
  return anotacao.name();
}

代码示例来源:origin: com.googlecode.jdbc-proc.jdbc-proc/jdbc-proc-daofactory

@SuppressWarnings("unchecked")
private String getListTableName(Class entityClass) {
  Entity entity = (Entity) entityClass.getAnnotation(Entity.class);
  Assert.notNull(entity, "No Entity annotation found in " + entityClass.getSimpleName());
  Assert.hasText(entity.name(),
      "Entity name is empty in Entity annotation for " + entityClass.getSimpleName());
  return entity.name();
}

代码示例来源:origin: org.eclipse.che.core/che-core-commons-test

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();
 }
}

代码示例来源:origin: org.springframework.data/spring-data-jpa

@Override
  public String getEntityName() {

    Entity entity = AnnotatedElementUtils.findMergedAnnotation(domainType, Entity.class);
    return null != entity && StringUtils.hasText(entity.name()) ? entity.name() : domainType.getSimpleName();
  }
}

代码示例来源:origin: hatunet/spring-data-mybatis

@Override
public String getEntityName() {
  Entity entity = AnnotatedElementUtils.findMergedAnnotation(domainType,
      Entity.class);
  return null != entity && StringUtils.hasText(entity.name()) ? entity.name()
      : domainType.getSimpleName();
}

代码示例来源:origin: com.querydsl/querydsl-jpa

private String getEntityName(Class<?> clazz) {
  final Entity entityAnnotation = clazz.getAnnotation(Entity.class);
  if (entityAnnotation != null && entityAnnotation.name().length() > 0) {
    return entityAnnotation.name();
  } else if (clazz.getPackage() != null) {
    String pn = clazz.getPackage().getName();
    return clazz.getName().substring(pn.length() + 1);
  } else {
    return clazz.getName();
  }
}

代码示例来源:origin: xiaolongzuo/niubi-job

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();
  }
}

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

private void bindEjb3Annotation(Entity ejb3Ann) {
  if ( ejb3Ann == null ) throw new AssertionFailure( "@Entity should always be not null" );
  if ( BinderHelper.isDefault( ejb3Ann.name() ) ) {
    name = StringHelper.unqualify( annotatedClass.getName() );
  }
  else {
    name = ejb3Ann.name();
  }
}

代码示例来源:origin: j256/ormlite-core

@Override
public String getEntityName(Class<?> clazz) {
  Entity entityAnnotation = clazz.getAnnotation(Entity.class);
  Table tableAnnotation = clazz.getAnnotation(Table.class);
  if (entityAnnotation != null && stringNotEmpty(entityAnnotation.name())) {
    return entityAnnotation.name();
  }
  if (tableAnnotation != null && stringNotEmpty(tableAnnotation.name())) {
    return tableAnnotation.name();
  }
  return null;
}

代码示例来源:origin: com.j256.ormlite/ormlite-core

@Override
public String getEntityName(Class<?> clazz) {
  Entity entityAnnotation = clazz.getAnnotation(Entity.class);
  Table tableAnnotation = clazz.getAnnotation(Table.class);
  if (entityAnnotation != null && stringNotEmpty(entityAnnotation.name())) {
    return entityAnnotation.name();
  }
  if (tableAnnotation != null && stringNotEmpty(tableAnnotation.name())) {
    return tableAnnotation.name();
  }
  return null;
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

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();
  }
}

代码示例来源:origin: ebean-orm/ebean

if (entity != null) {
 descriptor.setEntityType(EntityType.ORM);
 if (entity.name().isEmpty()) {
  descriptor.setName(cls.getSimpleName());
 } else {
  descriptor.setName(entity.name());

相关文章